Skip to content

Commit

Permalink
Made _source parsing in top_hits aggregation consistent with regu…
Browse files Browse the repository at this point in the history
…lar `_source` parsing in search api.

Closes elastic#6997
  • Loading branch information
martijnvg committed Jul 24, 2014
1 parent 30818b0 commit 067757f
Showing 1 changed file with 4 additions and 12 deletions.
Expand Up @@ -70,6 +70,10 @@ public AggregatorFactory parse(String aggregationName, XContentParser parser, Se
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":
Expand All @@ -78,9 +82,6 @@ public AggregatorFactory parse(String aggregationName, XContentParser parser, Se
case "size":
topHitsContext.size(parser.intValue());
break;
case "sort":
sortParseElement.parse(parser, topHitsContext);
break;
case "track_scores":
case "trackScores":
topHitsContext.trackScores(parser.booleanValue());
Expand All @@ -96,12 +97,6 @@ public AggregatorFactory parse(String aggregationName, XContentParser parser, Se
}
} 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;
Expand All @@ -114,9 +109,6 @@ public AggregatorFactory parse(String aggregationName, XContentParser parser, Se
}
} 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);
Expand Down

0 comments on commit 067757f

Please sign in to comment.