@@ -193,20 +193,32 @@ phase. Instead, highlighting needs to be performed via
193
193
194
194
=============================================
195
195
196
- [[limit-number-nested-fields]]
197
- ==== Limiting the number of `nested` fields
198
-
199
- Indexing a document with 100 nested fields actually indexes 101 documents as each nested
200
- document is indexed as a separate document. To safeguard against ill-defined mappings
201
- the number of nested fields that can be defined per index has been limited to 50. See
202
- <<mapping-limit-settings>>.
203
-
204
- [[limit-nested-json-objects-number]]
205
- ==== Limiting the number of `nested` json objects
206
- Indexing a document with an array of 100 objects within a nested field, will actually
207
- create 101 documents, as each nested object will be indexed as a separate document.
208
- To prevent out of memory errors when a single document contains too many nested json
209
- objects, the number of nested json objects that a single document may contain across all fields
210
- has been limited to 10000. See <<mapping-limit-settings>>.
196
+ [float]
197
+ === Limits on `nested` mappings and objects
198
+
199
+ As described earlier, each nested object is indexed as a separate document under the hood.
200
+ Continuing with the example above, if we indexed a single document containing 100 `user` objects,
201
+ then 101 Lucene documents would be created -- one for the parent document, and one for each
202
+ nested object. Because of the expense associated with `nested` mappings, Elasticsearch puts
203
+ settings in place to guard against performance problems:
204
+
205
+ `index.mapping.nested_fields.limit`::
206
+
207
+ The `nested` type should only be used in special cases, when arrays of objects need to be
208
+ queried independently of each other. To safeguard against poorly designed mappings, this setting
209
+ limits the number of unique `nested` types per index. In our example, the `user` mapping would
210
+ count as only 1 towards this limit.
211
+
212
+ `index.mapping.nested_objects.limit`::
213
+
214
+ This setting limits the number of nested objects that a single document may contain across all
215
+ `nested` types, in order to prevent out of memory errors when a document contains too many nested
216
+ objects. To illustrate how the setting works, say we added another `nested` type called `comments`
217
+ to our example mapping above. Then for each document, the combined number of `user` and `comment`
218
+ objects it contains must be below the limit.
219
+
220
+ Additional background on these settings, including information on their default values, can be found
221
+ in <<mapping-limit-settings>>.
222
+
211
223
212
224
0 commit comments