How to deal with nested fields limit


ES sets 50 as a limit of nested fields, as explained here:

As we plan to store potentially large objects in ES, we are thinking, how to deal with it. As a first step, I created an object with a nested field and filled 200 items in the nested collection. The object was indexed without complaining.

So my first question is, if I probably have a wrong understanding of the nested_fields.limit. Does it mean, that all nested fields of an index type are limited to a total of 50 items or does it mean, that maximum 50 nested arrays are allowed?

My second question is, what is the recommended strategy for the case, that one have objects containing arrays with lots of items to store in ES (or objects with lots of arrays inside). Is it better to increase the nested fields limit or is it better to save the arrays / array items in a separate index and get the root objects by merging the data from two (or more) indices?


It's a limit on the number of fields declared in the mapping as type nested - not the number of array elements you choose to add as values for any of those fields

See this flowchart to help decide. You shouldn't need nested if you only search on single fields at a time - it's when you AND properties from 2 different fields that the "cross-matching" problem occurs and you need to reach for nested to make the objects different matchable entities.

Thank you very much!

1 Like

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