-
Notifications
You must be signed in to change notification settings - Fork 24.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Limit the number of nested documents (#27405)
Add an index level setting `index.mapping.nested_objects.limit` to control the number of nested json objects that can be in a single document across all fields. Defaults to 10000. Throw an error if the number of created nested documents exceed this limit during the parsing of a document. Closes #26962
- Loading branch information
1 parent
4cffe8f
commit 57e4d10
Showing
8 changed files
with
222 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
rest-api-spec/src/main/resources/rest-api-spec/test/create/70_nested.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
setup: | ||
- do: | ||
indices.create: | ||
index: test_1 | ||
body: | ||
settings: | ||
index.mapping.nested_objects.limit: 2 | ||
mappings: | ||
test_type: | ||
properties: | ||
nested1: | ||
type: nested | ||
|
||
--- | ||
"Indexing a doc with No. nested objects less or equal to index.mapping.nested_objects.limit should succeed": | ||
- skip: | ||
version: " - 6.99.99" | ||
reason: index.mapping.nested_objects setting has been added in 7.0.0 | ||
- do: | ||
create: | ||
index: test_1 | ||
type: test_type | ||
id: 1 | ||
body: | ||
"nested1" : [ { "foo": "bar" }, { "foo": "bar2" } ] | ||
- match: { _version: 1} | ||
|
||
--- | ||
"Indexing a doc with No. nested objects more than index.mapping.nested_objects.limit should fail": | ||
- skip: | ||
version: " - 6.99.99" | ||
reason: index.mapping.nested_objects setting has been added in 7.0.0 | ||
- do: | ||
catch: /The number of nested documents has exceeded the allowed limit of \[2\]. This limit can be set by changing the \[index.mapping.nested_objects.limit\] index level setting\./ | ||
create: | ||
index: test_1 | ||
type: test_type | ||
id: 1 | ||
body: | ||
"nested1" : [ { "foo": "bar" }, { "foo": "bar2" }, { "foo": "bar3" } ] |