# How to exclude fields from being indexed in ElasticSearch?

**URL:** <https://discuss.elastic.co/t/how-to-exclude-fields-from-being-indexed-in-elasticsearch/267427>\
**Category:** Elasticsearch\
**Created:** [March 16, 2021, 10:39pm UTC](https://discuss.elastic.co/t/how-to-exclude-fields-from-being-indexed-in-elasticsearch/267427 "2021-03-16T22:39:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jay2021](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@jay2021](https://discuss.elastic.co/u/jay2021)\
**Post date:** [March 16, 2021, 10:39pm UTC](https://discuss.elastic.co/t/how-to-exclude-fields-from-being-indexed-in-elasticsearch/267427/1 "2021-03-16T22:39:40Z")

</div>

I am trying to utilize ElasticSearch to store large sets of data. Most of the data will be searchable, however, there are some field that will be there just so the data is stored and returned upon request.

Here is my mapping

```auto
{
  "mappings": {
    "properties": {
      "amenities": {
        "type": "completion"
      },
      "summary": {
        "type": "text"
      },
      "street_number": {
        "type": "text"
      },
      "street_name": {
        "type": "text"
      },
      "street_suffix": {
        "type": "text"
      },
      "city": {
        "type": "text",
        "fields": {
          "raw": { 
            "type": "keyword"
          }
      },
      "state_or_province": {
        "type": "text"
      },
      "postal_code": {
        "type": "text"
      },
      "mlsid": {
        "type": "text"
      },
      "source_id": {
        "type": "text"
      },
      "status": {
        "type": "keyword"
      },
      "type": {
        "type": "keyword"
      },
      "subtype": {
        "type": "keyword"
      },
      "year_built": {
        "type": "short"
      },
      "community": {
        "type": "keyword"
      },
      "elementary_school": {
        "type": "keyword"
      },
      "middle_school": {
        "type": "keyword"
      },
      "jr_high_school": {
        "type": "keyword"
      },
      "high_school": {
        "type": "keyword"
      },
      "area_size": {
        "type": "double"
      },
      "lot_size": {
        "type": "double"
      },
      "bathrooms": {
        "type": "double"
      },
      "bedrooms": {
        "type": "double"
      },
      "listed_at": {
        "type": "date"
      },
      "price": {
        "type": "double"
      },
      "sold_at": {
        "type": "date"
      },
      "sold_for": {
        "type": "double"
      },
      "total_photos": {
        "type": "short"
      },
      "formatted_addressLine": {
        "type": "text"
      },
      "formatted_address": {
        "type": "text"
      },
      "location": {
        "type": "geo_point"
      },
      "price_changes": {
        "type": "object"
      },
      "fields": {
        "type": "object"
      },
      "deleted_at": {
        "type": "date"
      },
      "is_available": {
        "type": "boolean"
      },
      "is_unable_to_find_coordinates": {
        "type": "boolean"
      },
      "source": {
        "type": "keyword"
      }
    }
  }
}

```

The `fields` and `price_changes` properties are there in case the user want to read that info. But that info should not be searchable or indexed. The `fields` holds a large list of `key-value` pairs whereas `price_changes` fields hold multiple objects of the same type.

Currently, when I attempt to bulk create records, I get `Limit of total fields [1000] has been exceeded` error. I am guessing this error is happening because every key-value pair in the `fields` collection is considered a field in elasticsearch.

How can I store the `fields` and the `price_changes` object as non-searchable data and not index it or count it toward the fields count?

---

<div class="post-metadata">

**Author:** ![AClerk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aclerk/32/55297_2.png) [@AClerk](https://discuss.elastic.co/u/AClerk)\
**Post date:** [March 16, 2021, 11:54pm UTC](https://discuss.elastic.co/t/how-to-exclude-fields-from-being-indexed-in-elasticsearch/267427/2 "2021-03-16T23:54:50Z")

</div>

I think [enabled](https://www.elastic.co/guide/en/elasticsearch/reference/current/enabled.html) is your solution.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 13, 2021, 11:55pm UTC](https://discuss.elastic.co/t/how-to-exclude-fields-from-being-indexed-in-elasticsearch/267427/3 "2021-04-13T23:55:27Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
