Made `_source` parsing in `top_hits` aggregation consistent with regular `_source` parsing in search api.
Closes #6997
This commit is contained in:
parent
8cb4471cca
commit
73f7f426de
|
@ -70,6 +70,10 @@ public class TopHitsParser implements Aggregator.Parser {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if ("sort".equals(currentFieldName)) {
|
||||
sortParseElement.parse(parser, topHitsContext);
|
||||
} else if ("_source".equals(currentFieldName)) {
|
||||
sourceParseElement.parse(parser, topHitsContext);
|
||||
} else if (token.isValue()) {
|
||||
switch (currentFieldName) {
|
||||
case "from":
|
||||
|
@ -78,9 +82,6 @@ public class TopHitsParser implements Aggregator.Parser {
|
|||
case "size":
|
||||
topHitsContext.size(parser.intValue());
|
||||
break;
|
||||
case "sort":
|
||||
sortParseElement.parse(parser, topHitsContext);
|
||||
break;
|
||||
case "track_scores":
|
||||
case "trackScores":
|
||||
topHitsContext.trackScores(parser.booleanValue());
|
||||
|
@ -96,12 +97,6 @@ public class TopHitsParser implements Aggregator.Parser {
|
|||
}
|
||||
} else if (token == XContentParser.Token.START_OBJECT) {
|
||||
switch (currentFieldName) {
|
||||
case "sort":
|
||||
sortParseElement.parse(parser, topHitsContext);
|
||||
break;
|
||||
case "_source":
|
||||
sourceParseElement.parse(parser, topHitsContext);
|
||||
break;
|
||||
case "highlight":
|
||||
highlighterParseElement.parse(parser, topHitsContext);
|
||||
break;
|
||||
|
@ -114,9 +109,6 @@ public class TopHitsParser implements Aggregator.Parser {
|
|||
}
|
||||
} else if (token == XContentParser.Token.START_ARRAY) {
|
||||
switch (currentFieldName) {
|
||||
case "sort":
|
||||
sortParseElement.parse(parser, topHitsContext);
|
||||
break;
|
||||
case "fielddataFields":
|
||||
case "fielddata_fields":
|
||||
fieldDataFieldsParseElement.parse(parser, topHitsContext);
|
||||
|
|
Loading…
Reference in New Issue