supported field type tests for max agg (#53701)
Adds test hooks for testing supported ValuesSource types for the max aggregation
This commit is contained in:
parent
5d0351ea00
commit
ec76e7306e
|
@ -71,7 +71,9 @@ import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||||
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
|
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
|
||||||
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregator;
|
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregator;
|
||||||
import org.elasticsearch.search.aggregations.support.AggregationInspectionHelper;
|
import org.elasticsearch.search.aggregations.support.AggregationInspectionHelper;
|
||||||
|
import org.elasticsearch.search.aggregations.support.CoreValuesSourceType;
|
||||||
import org.elasticsearch.search.aggregations.support.ValueType;
|
import org.elasticsearch.search.aggregations.support.ValueType;
|
||||||
|
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||||
import org.elasticsearch.search.lookup.LeafDocLookup;
|
import org.elasticsearch.search.lookup.LeafDocLookup;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -89,6 +91,7 @@ import java.util.function.Supplier;
|
||||||
|
|
||||||
import static java.util.Collections.emptyList;
|
import static java.util.Collections.emptyList;
|
||||||
import static java.util.Collections.singleton;
|
import static java.util.Collections.singleton;
|
||||||
|
import static java.util.Collections.singletonList;
|
||||||
import static org.elasticsearch.index.query.QueryBuilders.termQuery;
|
import static org.elasticsearch.index.query.QueryBuilders.termQuery;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
|
||||||
|
@ -158,6 +161,17 @@ public class MaxAggregatorTests extends AggregatorTestCase {
|
||||||
return new ScriptService(Settings.EMPTY, engines, ScriptModule.CORE_CONTEXTS);
|
return new ScriptService(Settings.EMPTY, engines, ScriptModule.CORE_CONTEXTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<ValuesSourceType> getSupportedValuesSourceTypes() {
|
||||||
|
return singletonList(CoreValuesSourceType.NUMERIC);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected AggregationBuilder createAggBuilderForTypeTest(MappedFieldType fieldType, String fieldName) {
|
||||||
|
return new MaxAggregationBuilder("_name")
|
||||||
|
.field(fieldName);
|
||||||
|
}
|
||||||
|
|
||||||
public void testNoDocs() throws IOException {
|
public void testNoDocs() throws IOException {
|
||||||
testCase(new MatchAllDocsQuery(), iw -> {
|
testCase(new MatchAllDocsQuery(), iw -> {
|
||||||
// Intentionally not writing any docs
|
// Intentionally not writing any docs
|
||||||
|
|
Loading…
Reference in New Issue