diff options
author | Tanguy Leroux <tlrx.dev@gmail.com> | 2017-04-18 17:03:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-18 17:03:32 +0200 |
commit | 829dd068d61da9ec48f9f6d60d8d3b96687f3559 (patch) | |
tree | dce2bc8e171f34a6939179f143955047e82ffd5a /core/src/test/java/org/elasticsearch/search/aggregations/bucket | |
parent | 0b15fde27a071037885c8d644b06d607ebe77428 (diff) |
[Test] Use appropriate DocValueFormats in Aggregations tests (#24155)
Some aggregations (like Min, Max etc) use a wrong DocValueFormat in
tests (like IP or GeoHash). We should not test aggregations that expect
a numeric value with a DocValueFormat like IP. Such wrong DocValueFormat
can also prevent the aggregation to be rendered as ToXContent, and this
will be an issue for the High Level Rest Client tests which expect to be
able to parse back aggregations.
Diffstat (limited to 'core/src/test/java/org/elasticsearch/search/aggregations/bucket')
-rw-r--r-- | core/src/test/java/org/elasticsearch/search/aggregations/bucket/InternalSingleBucketAggregationTestCase.java | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/bucket/InternalSingleBucketAggregationTestCase.java b/core/src/test/java/org/elasticsearch/search/aggregations/bucket/InternalSingleBucketAggregationTestCase.java index 6f8dac7eec..5d2e8affe7 100644 --- a/core/src/test/java/org/elasticsearch/search/aggregations/bucket/InternalSingleBucketAggregationTestCase.java +++ b/core/src/test/java/org/elasticsearch/search/aggregations/bucket/InternalSingleBucketAggregationTestCase.java @@ -19,7 +19,6 @@ package org.elasticsearch.search.aggregations.bucket; -import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregationTestCase; import org.elasticsearch.search.aggregations.InternalAggregations; @@ -47,14 +46,10 @@ public abstract class InternalSingleBucketAggregationTestCase<T extends Internal protected final T createTestInstance(String name, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) { List<InternalAggregation> internal = new ArrayList<>(); if (hasInternalMax) { - internal.add(new InternalMax("max", randomDouble(), - randomFrom(DocValueFormat.BOOLEAN, DocValueFormat.GEOHASH, DocValueFormat.IP, DocValueFormat.RAW), emptyList(), - emptyMap())); + internal.add(new InternalMax("max", randomDouble(), randomNumericDocValueFormat(), emptyList(), emptyMap())); } if (hasInternalMin) { - internal.add(new InternalMin("min", randomDouble(), - randomFrom(DocValueFormat.BOOLEAN, DocValueFormat.GEOHASH, DocValueFormat.IP, DocValueFormat.RAW), emptyList(), - emptyMap())); + internal.add(new InternalMin("min", randomDouble(), randomNumericDocValueFormat(), emptyList(), emptyMap())); } // we shouldn't use the full long range here since we sum doc count on reduce, and don't want to overflow the long range there long docCount = between(0, Integer.MAX_VALUE); |