Skip to content

Commit 9d6e147

Browse files
committed
update for test execution
1 parent 369dc05 commit 9d6e147

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/create/70_nested.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ setup:
2727
"Indexing a doc with No. nested objects more than index.mapping.nested_objects.limit should fail":
2828

2929
- do:
30-
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\./
30+
catch: /The number array objects has exceeded the allowed limit of \[2\]. This limit can be set by changing the \[index.mapping.nested_objects.limit\] index level setting\./
3131
create:
3232
index: test_1
3333
id: "1"

server/src/main/java/org/elasticsearch/index/mapper/DocumentParser.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import org.elasticsearch.common.xcontent.XContentHelper;
1818
import org.elasticsearch.core.Nullable;
1919
import org.elasticsearch.features.NodeFeature;
20+
import org.elasticsearch.index.IndexSettings;
2021
import org.elasticsearch.index.IndexVersion;
2122
import org.elasticsearch.index.IndexVersions;
2223
import org.elasticsearch.index.fielddata.FieldDataContext;
@@ -755,7 +756,9 @@ private static void parseNonDynamicArray(
755756
if (token == XContentParser.Token.START_OBJECT) {
756757
if (countArray++ >= nestedDocsLimit) {
757758
throw new IllegalStateException(
758-
"Limit [" + nestedDocsLimit + "] of elements in an array field [" + lastFieldName + "] " + "has been exceeded"
759+
"The number array objects has exceeded the allowed limit of [" + nestedDocsLimit + "]. " +
760+
"This limit can be set by changing the [" + MapperService.INDEX_MAPPING_NESTED_DOCS_LIMIT_SETTING.getKey()
761+
+ "] index level setting."
759762
);
760763
}
761764
elements = 2;

server/src/test/java/org/elasticsearch/index/mapper/NestedObjectMapperTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ public void testLimitNestedDocsDefaultSettings() throws Exception {
857857
assertThat(
858858
e.getMessage(),
859859
containsString(
860-
"The number of nested documents has exceeded the allowed limit of ["
860+
"[1:108903] failed to parse: The number array objects has exceeded the allowed limit of ["
861861
+ defaultMaxNoNestedDocs
862862
+ "]. This limit can be set by changing the ["
863863
+ MapperService.INDEX_MAPPING_NESTED_DOCS_LIMIT_SETTING.getKey()
@@ -905,7 +905,7 @@ public void testLimitNestedDocs() throws Exception {
905905
SourceToParse source2 = new SourceToParse("2", BytesReference.bytes(docBuilder2), XContentType.JSON);
906906
DocumentParsingException e = expectThrows(DocumentParsingException.class, () -> docMapper.parse(source2));
907907
assertEquals(
908-
"[1:73] The number of nested documents has exceeded the allowed limit of ["
908+
"[1:73] failed to parse: The number array objects has exceeded the allowed limit of ["
909909
+ maxNoNestedDocs
910910
+ "]. This limit can be set by changing the ["
911911
+ MapperService.INDEX_MAPPING_NESTED_DOCS_LIMIT_SETTING.getKey()

0 commit comments

Comments
 (0)