summaryrefslogtreecommitdiff
path: root/core/src/main/java/org/elasticsearch/search/aggregations/metrics
diff options
context:
space:
mode:
authorChristoph Büscher <christoph@elastic.co>2017-06-29 17:10:20 +0200
committerGitHub <noreply@github.com>2017-06-29 17:10:20 +0200
commit927111c91dac5e3cef868eead3cfe8fd4075bee5 (patch)
treed1879782d7d0c5a44323e211d44e5f5bbfc87913 /core/src/main/java/org/elasticsearch/search/aggregations/metrics
parent22ff76da0c7eaaadfb4f5127770bdeba9eb0e6ac (diff)
Remove QueryParseContext from parsing QueryBuilders (#25448)
Currently QueryParseContext is only a thin wrapper around an XContentParser that adds little functionality of its own. I provides helpers for long deprecated field names which can be removed and two helper methods that can be made static and moved to other classes. This is a first step in helping to remove QueryParseContext entirely.
Diffstat (limited to 'core/src/main/java/org/elasticsearch/search/aggregations/metrics')
-rw-r--r--core/src/main/java/org/elasticsearch/search/aggregations/metrics/tophits/TopHitsAggregationBuilder.java7
1 files changed, 3 insertions, 4 deletions
diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/tophits/TopHitsAggregationBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/tophits/TopHitsAggregationBuilder.java
index 2739427cfe..c131ecfee1 100644
--- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/tophits/TopHitsAggregationBuilder.java
+++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/tophits/TopHitsAggregationBuilder.java
@@ -29,7 +29,6 @@ import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.index.query.QueryParseContext;
import org.elasticsearch.index.query.QueryShardContext;
import org.elasticsearch.script.Script;
-import org.elasticsearch.script.ScriptContext;
import org.elasticsearch.script.SearchScript;
import org.elasticsearch.search.aggregations.AbstractAggregationBuilder;
import org.elasticsearch.search.aggregations.AggregationInitializationException;
@@ -671,9 +670,9 @@ public class TopHitsAggregationBuilder extends AbstractAggregationBuilder<TopHit
}
factory.scriptFields(scriptFields);
} else if (SearchSourceBuilder.HIGHLIGHT_FIELD.match(currentFieldName)) {
- factory.highlighter(HighlightBuilder.fromXContent(context));
+ factory.highlighter(HighlightBuilder.fromXContent(parser));
} else if (SearchSourceBuilder.SORT_FIELD.match(currentFieldName)) {
- List<SortBuilder<?>> sorts = SortBuilder.fromXContent(context);
+ List<SortBuilder<?>> sorts = SortBuilder.fromXContent(parser);
factory.sorts(sorts);
} else {
throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + currentFieldName + "].",
@@ -696,7 +695,7 @@ public class TopHitsAggregationBuilder extends AbstractAggregationBuilder<TopHit
}
factory.fieldDataFields(fieldDataFields);
} else if (SearchSourceBuilder.SORT_FIELD.match(currentFieldName)) {
- List<SortBuilder<?>> sorts = SortBuilder.fromXContent(context);
+ List<SortBuilder<?>> sorts = SortBuilder.fromXContent(parser);
factory.sorts(sorts);
} else if (SearchSourceBuilder._SOURCE_FIELD.match(currentFieldName)) {
factory.fetchSource(FetchSourceContext.fromXContent(context.parser()));