# The ways don't index several fields

**URL:** <https://forum.opensearch.org/t/the-ways-dont-index-several-fields/9595>\
**Category:** OpenSearch\
**Tags:** discuss, configure\
**Created:** [May 17, 2022, 7:59am UTC](https://forum.opensearch.org/t/the-ways-dont-index-several-fields/9595 "2022-05-17T07:59:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![hugok](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/hugok/32/3116_2.png) [@hugok](https://forum.opensearch.org/u/hugok)\
**Post date:** [May 17, 2022, 7:59am UTC](https://forum.opensearch.org/t/the-ways-dont-index-several-fields/9595/1 "2022-05-17T07:59:47Z")

</div>

My document has fields a,b,c. The field b should be indexed and searchable. The a and c doesn’t need to be searchable. So I think it may save time to index each document by not indexing unnecessary fields such as fields a and c in the example. But I want them to be visible.  
Is this the correct mapping setting?

```auto
        },
        "a" : {
          "type" : "text",
          "index" : false,
          "norms" : false
        },
        "b" : {
          "type" : "keyword",
          "ignore_above" : 1024
        },
        "c" : {
          "type" : "text",
          "index" : false,
          "norms" : false
        },

```

I found three different mapping parameters and not sure which is the right one to use.

```auto
index: false
index: no
enabled: false

```

Regards // Hugo

---

<div class="post-metadata">

**Author:** ![nateynate](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/nateynate/32/4913_2.png) [@nateynate](https://forum.opensearch.org/u/nateynate)\
**Post date:** [May 17, 2022, 10:43pm UTC](https://forum.opensearch.org/t/the-ways-dont-index-several-fields/9595/2 "2022-05-17T22:43:38Z")

</div>

Hi @hugok - I wrote a blog article about this a while back. What you’ve provided above looks correct. This might help clear up your confusion:

> **[Fine Dining for Indices](https://opensearch.org/blog/intro/2022/03/fine-dining-for-indices/)**
>
> OpenSearch is a community-driven, Apache 2.0-licensed open source search and analytics suite that makes it easy to ingest, search, visualize, and analyze data.

The short form is that to intentionally not index a field, you would provide

```auto
"index": false

```

You’ll still be able to retrieve the source of the document if it is returned as a search result, but the field won’t be indexed.

One thing to keep in mind is that if you’re using a dynamic mapping on your index, it will create new mappings when it ingests a field that it hasn’t seen yet. To keep dynamic mappings from growing your indices, you can also use

```auto
"dynamic": false

```

inside of the `mappings` stanza. If you try to ingest a field for which there is no mapping, an error will take place.

TL:DR; It looks like you’ve done it right to me. Be aware of accidentally adding mappings by ingesting new fields.

Nate

---

<div class="post-metadata">

**Author:** ![hugok](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/hugok/32/3116_2.png) [@hugok](https://forum.opensearch.org/u/hugok)\
**Post date:** [May 19, 2022, 4:21am UTC](https://forum.opensearch.org/t/the-ways-dont-index-several-fields/9595/3 "2022-05-19T04:21:44Z")

</div>

Hi @nateynate ,

This is great information. I’m reading your post now.  
Thanks for the explanation.

Hugo

---

<div class="post-metadata">

**Author:** ![nateynate](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/nateynate/32/4913_2.png) [@nateynate](https://forum.opensearch.org/u/nateynate)\
**Post date:** [May 19, 2022, 3:21pm UTC](https://forum.opensearch.org/t/the-ways-dont-index-several-fields/9595/4 "2022-05-19T15:21:09Z")

</div>

Just happy to be of service, @hugok! Good luck!

---

<div class="post-metadata">

**Author:** ![jbarranco](https://avatars.discourse-cdn.com/v4/letter/j/e274bd/32.png) [@jbarranco](https://forum.opensearch.org/u/jbarranco)\
**Post date:** [November 30, 2022, 8:47pm UTC](https://forum.opensearch.org/t/the-ways-dont-index-several-fields/9595/5 "2022-11-30T20:47:59Z")

</div>

I’m getting errors on OS 1.3.2:

```auto
Mapping definition for [content] has unsupported parameters: [index : false]" 

```

when attempting to use above solution of: “index” = false. Instead, I am opting to use use “dynamic” = false

---

<div class="post-metadata">

**Author:** ![maxfriz](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@maxfriz](https://forum.opensearch.org/u/maxfriz)\
**Post date:** [March 9, 2023, 9:33pm UTC](https://forum.opensearch.org/t/the-ways-dont-index-several-fields/9595/6 "2023-03-09T21:33:17Z")

</div>

@nateynate I read your blog _Fine Dining for Indices_. Great article. I have been reviewing OpenSearch (and even Elasticsearch documentation) relevant to index:false. In your example in your article:

```auto
"dont_index_me": {
                "type": "text",
                "index": false
            }

```

What is the benefit of specifying a type (in this case _text_) if you are specifically configuring this element to not be indexed?

I appreciate your feedback. I’m sure the answer was glaring at me in the documentation and I simply overlooked it.

Thank you.

Max Friz

---

<div class="post-metadata">

**Author:** ![nateynate](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/nateynate/32/4913_2.png) [@nateynate](https://forum.opensearch.org/u/nateynate)\
**Post date:** [March 13, 2023, 10:43pm UTC](https://forum.opensearch.org/t/the-ways-dont-index-several-fields/9595/7 "2023-03-13T22:43:14Z")

</div>

Thanks for the question @maxfriz and I’m glad you liked the article.

I always like to provide a type for the field in case I ever want to re-index. Those values are still in the “source” of the document, so in the case of a reindex it will know what type - otherwise (not 100% sure) it will use dynamic typing and it may not get it right.)

Thanks for the mention!

Nate
