# Limiting dynamic properties/fields indexed

**URL:** <https://discuss.elastic.co/t/limiting-dynamic-properties-fields-indexed/275585>\
**Category:** Elasticsearch\
**Created:** [June 10, 2021, 2:06pm UTC](https://discuss.elastic.co/t/limiting-dynamic-properties-fields-indexed/275585 "2021-06-10T14:06:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ronchalant](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ronchalant/32/3611_2.png) [@ronchalant](https://discuss.elastic.co/u/ronchalant)\
**Post date:** [June 10, 2021, 2:06pm UTC](https://discuss.elastic.co/t/limiting-dynamic-properties-fields-indexed/275585/1 "2021-06-10T14:06:53Z")

</div>

We're migrating to ES7, and for one of our indexes which stores email data we are hitting the "Limit of total fields [1000]" error.

The reason for this is we're indexing all headers, and for some emails the number of headers in addition to the standard fields exceeds 1000.

What I'd prefer to do is set up the headers field so that ES simply ignores any properties received over a number I configure. So for example, I'd want to limit the number of headers to the first 100 that ES encounters and have it quietly ignore the rest, maybe logging a warning in the task.

For future data we could restrict the number of fields at index time, but we want to be able to reindex existing documents from another cluster without regenerating all the documents - which is an expensive task.

I haven't been able to find anything that allows me to configure a particular property that limits the fields beneath it. Is there anything like that?

---

<div class="post-metadata">

**Author:** ![mayya](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mayya/32/83147_2.png) [@mayya](https://discuss.elastic.co/u/mayya)\
**Post date:** [June 10, 2021, 8:15pm UTC](https://discuss.elastic.co/t/limiting-dynamic-properties-fields-indexed/275585/2 "2021-06-10T20:15:06Z")

</div>

There is no setting to limit the number of fields under a specific field, there is only `index.mapping.total_fields.limit` that limits the number of fields for the whole index.

---

<div class="post-metadata">

**Author:** ![ronchalant](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ronchalant/32/3611_2.png) [@ronchalant](https://discuss.elastic.co/u/ronchalant)\
**Post date:** [June 11, 2021, 12:51pm UTC](https://discuss.elastic.co/t/limiting-dynamic-properties-fields-indexed/275585/3 "2021-06-11T12:51:00Z")

</div>

That's what I figured, we'll look to adjust that number up higher by default but also limit the number of fields we index to keep it running more robust

---

<div class="post-metadata">

**Author:** ![mayya](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mayya/32/83147_2.png) [@mayya](https://discuss.elastic.co/u/mayya)\
**Post date:** [June 11, 2021, 9:48pm UTC](https://discuss.elastic.co/t/limiting-dynamic-properties-fields-indexed/275585/4 "2021-06-11T21:48:47Z")

</div>

One thing probably worth to add is that you can set up `dynamic: false` on the specific object field level. This will allow to add new fields to your index, but will not allow to add new field under the given object.

---

<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:** [July 9, 2021, 9:49pm UTC](https://discuss.elastic.co/t/limiting-dynamic-properties-fields-indexed/275585/5 "2021-07-09T21:49:10Z")

</div>

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