Register ParsedTopHits aggregation with the rest high level client (#26370)
This commit is contained in:
parent
661648b3aa
commit
f6bbc91c0d
|
@ -120,6 +120,8 @@ import org.elasticsearch.search.aggregations.metrics.stats.extended.ExtendedStat
|
|||
import org.elasticsearch.search.aggregations.metrics.stats.extended.ParsedExtendedStats;
|
||||
import org.elasticsearch.search.aggregations.metrics.sum.ParsedSum;
|
||||
import org.elasticsearch.search.aggregations.metrics.sum.SumAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.tophits.ParsedTopHits;
|
||||
import org.elasticsearch.search.aggregations.metrics.tophits.TopHitsAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.valuecount.ParsedValueCount;
|
||||
import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCountAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.pipeline.InternalSimpleValue;
|
||||
|
@ -602,6 +604,7 @@ public class RestHighLevelClient implements Closeable {
|
|||
map.put(SignificantLongTerms.NAME, (p, c) -> ParsedSignificantLongTerms.fromXContent(p, (String) c));
|
||||
map.put(SignificantStringTerms.NAME, (p, c) -> ParsedSignificantStringTerms.fromXContent(p, (String) c));
|
||||
map.put(ScriptedMetricAggregationBuilder.NAME, (p, c) -> ParsedScriptedMetric.fromXContent(p, (String) c));
|
||||
map.put(TopHitsAggregationBuilder.NAME, (p, c) -> ParsedTopHits.fromXContent(p, (String) c));
|
||||
List<NamedXContentRegistry.Entry> entries = map.entrySet().stream()
|
||||
.map(entry -> new NamedXContentRegistry.Entry(Aggregation.class, new ParseField(entry.getKey()), entry.getValue()))
|
||||
.collect(Collectors.toList());
|
||||
|
|
|
@ -628,7 +628,7 @@ public class RestHighLevelClientTests extends ESTestCase {
|
|||
|
||||
public void testDefaultNamedXContents() {
|
||||
List<NamedXContentRegistry.Entry> namedXContents = RestHighLevelClient.getDefaultNamedXContents();
|
||||
assertEquals(43, namedXContents.size());
|
||||
assertEquals(44, namedXContents.size());
|
||||
Map<Class<?>, Integer> categories = new HashMap<>();
|
||||
for (NamedXContentRegistry.Entry namedXContent : namedXContents) {
|
||||
Integer counter = categories.putIfAbsent(namedXContent.categoryClass, 1);
|
||||
|
@ -637,7 +637,7 @@ public class RestHighLevelClientTests extends ESTestCase {
|
|||
}
|
||||
}
|
||||
assertEquals(2, categories.size());
|
||||
assertEquals(Integer.valueOf(40), categories.get(Aggregation.class));
|
||||
assertEquals(Integer.valueOf(41), categories.get(Aggregation.class));
|
||||
assertEquals(Integer.valueOf(3), categories.get(Suggest.Suggestion.class));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue