Skip to content

Commit 6c46a67

Browse files
committed
added comment
1 parent a3a6ce6 commit 6c46a67

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

core/src/main/java/org/elasticsearch/search/fetch/FetchPhase.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,11 @@ private SearchHit createNestedSearchHit(SearchContext context, int nestedTopDocI
276276
}
277277
if ((nestedParsedSource.get(0) instanceof Map) == false &&
278278
nestedObjectMapper.parentObjectMapperAreNested(context.mapperService()) == false) {
279+
// When one of the parent objects are not nested then XContentMapValues.extractValue(...) extracts the values
280+
// from two or more layers resulting in a list of list being returned. This is because nestedPath
281+
// encapsulates two or more object layers in the _source.
282+
//
283+
// This is why only the first element of nestedParsedSource needs to be checked.
279284
throw new IllegalArgumentException("Cannot execute inner hits. One or more parent object fields of nested field [" +
280285
nestedObjectMapper.name() + "] are not nested. All parent fields need to be nested fields too");
281286
}

0 commit comments

Comments
 (0)