added comment

This commit is contained in:
Martijn van Groningen 2017-08-09 08:58:36 +02:00
parent a3a6ce6220
commit 6c46a67dd6
No known key found for this signature in database
GPG Key ID: AB236F4FCF2AF12A
1 changed files with 5 additions and 0 deletions

View File

@ -276,6 +276,11 @@ public class FetchPhase implements SearchPhase {
} }
if ((nestedParsedSource.get(0) instanceof Map) == false && if ((nestedParsedSource.get(0) instanceof Map) == false &&
nestedObjectMapper.parentObjectMapperAreNested(context.mapperService()) == false) { nestedObjectMapper.parentObjectMapperAreNested(context.mapperService()) == false) {
// When one of the parent objects are not nested then XContentMapValues.extractValue(...) extracts the values
// from two or more layers resulting in a list of list being returned. This is because nestedPath
// encapsulates two or more object layers in the _source.
//
// This is why only the first element of nestedParsedSource needs to be checked.
throw new IllegalArgumentException("Cannot execute inner hits. One or more parent object fields of nested field [" + throw new IllegalArgumentException("Cannot execute inner hits. One or more parent object fields of nested field [" +
nestedObjectMapper.name() + "] are not nested. All parent fields need to be nested fields too"); nestedObjectMapper.name() + "] are not nested. All parent fields need to be nested fields too");
} }