Move getProperty method out of Aggregation interface (#23949)
The `getProperty` method is an internal method needed to run pipeline aggregations and retrieve info by path from the aggs tree. It is not needed in the `Aggregation` interface, which is returned to users running aggregations from the transport client. The method is moved to the InternalAggregation class as that's where it belongs.
This commit is contained in:
parent
13cf8aaa52
commit
e156dbaf42
|
@ -30,15 +30,6 @@ public interface Aggregation {
|
|||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Get the value of specified path in the aggregation.
|
||||
*
|
||||
* @param path
|
||||
* the path to the property in the aggregation tree
|
||||
* @return the value of the property
|
||||
*/
|
||||
Object getProperty(String path);
|
||||
|
||||
/**
|
||||
* Get the optional byte array metadata that was set on the aggregation
|
||||
*/
|
||||
|
|
|
@ -132,7 +132,13 @@ public abstract class InternalAggregation implements Aggregation, ToXContent, Na
|
|||
|
||||
public abstract InternalAggregation doReduce(List<InternalAggregation> aggregations, ReduceContext reduceContext);
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Get the value of specified path in the aggregation.
|
||||
*
|
||||
* @param path
|
||||
* the path to the property in the aggregation tree
|
||||
* @return the value of the property
|
||||
*/
|
||||
public Object getProperty(String path) {
|
||||
AggregationPath aggPath = AggregationPath.parse(path);
|
||||
return getProperty(aggPath.getPathElementsAsStringList());
|
||||
|
|
|
@ -28,12 +28,11 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.index.IndexSettings;
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.adjacency.AdjacencyMatrix;
|
||||
import org.elasticsearch.search.aggregations.bucket.adjacency.AdjacencyMatrix.Bucket;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
import org.elasticsearch.search.aggregations.metrics.avg.Avg;
|
||||
import org.elasticsearch.search.query.QueryPhaseExecutionException;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.hamcrest.Matchers;
|
||||
|
||||
|
@ -48,7 +47,6 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.adjacenc
|
|||
import static org.elasticsearch.search.aggregations.AggregationBuilders.avg;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
@ -220,11 +218,11 @@ public class AdjacencyMatrixIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
assertThat(matrix.getBuckets().size(), equalTo(expectedBuckets));
|
||||
assertThat(matrix.getProperty("_bucket_count"), equalTo(expectedBuckets));
|
||||
assertThat(((InternalAggregation)matrix).getProperty("_bucket_count"), equalTo(expectedBuckets));
|
||||
|
||||
Object[] propertiesKeys = (Object[]) matrix.getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) matrix.getProperty("_count");
|
||||
Object[] propertiesCounts = (Object[]) matrix.getProperty("avg_value.value");
|
||||
Object[] propertiesKeys = (Object[]) ((InternalAggregation)matrix).getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) ((InternalAggregation)matrix).getProperty("_count");
|
||||
Object[] propertiesCounts = (Object[]) ((InternalAggregation)matrix).getProperty("avg_value.value");
|
||||
|
||||
assertEquals(expectedBuckets, propertiesKeys.length);
|
||||
assertEquals(propertiesKeys.length, propertiesDocCounts.length);
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.search.SearchHit;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilders;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.children.Children;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
import org.elasticsearch.search.aggregations.metrics.sum.Sum;
|
||||
|
@ -153,10 +154,10 @@ public class ChildrenIT extends ESIntegTestCase {
|
|||
Children childrenBucket = categoryBucket.getAggregations().get("to_comment");
|
||||
assertThat(childrenBucket.getName(), equalTo("to_comment"));
|
||||
assertThat(childrenBucket.getDocCount(), equalTo((long) entry1.getValue().commentIds.size()));
|
||||
assertThat((long) childrenBucket.getProperty("_count"), equalTo((long) entry1.getValue().commentIds.size()));
|
||||
assertThat((long) ((InternalAggregation)childrenBucket).getProperty("_count"), equalTo((long) entry1.getValue().commentIds.size()));
|
||||
|
||||
Terms commentersTerms = childrenBucket.getAggregations().get("commenters");
|
||||
assertThat((Terms) childrenBucket.getProperty("commenters"), sameInstance(commentersTerms));
|
||||
assertThat((Terms) ((InternalAggregation)childrenBucket).getProperty("commenters"), sameInstance(commentersTerms));
|
||||
assertThat(commentersTerms.getBuckets().size(), equalTo(entry1.getValue().commenterToCommentId.size()));
|
||||
for (Map.Entry<String, Set<String>> entry2 : entry1.getValue().commenterToCommentId.entrySet()) {
|
||||
Terms.Bucket commentBucket = commentersTerms.getBucketByKey(entry2.getKey());
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.elasticsearch.index.query.QueryBuilders;
|
|||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.DateScriptMocks.DateScriptsMockPlugin;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.ExtendedBounds;
|
||||
|
@ -377,10 +378,10 @@ public class DateHistogramIT extends ESIntegTestCase {
|
|||
assertThat(histo.getName(), equalTo("histo"));
|
||||
List<? extends Bucket> buckets = histo.getBuckets();
|
||||
assertThat(buckets.size(), equalTo(3));
|
||||
assertThat(histo.getProperty("_bucket_count"), equalTo(3));
|
||||
Object[] propertiesKeys = (Object[]) histo.getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) histo.getProperty("_count");
|
||||
Object[] propertiesCounts = (Object[]) histo.getProperty("sum.value");
|
||||
assertThat(((InternalAggregation)histo).getProperty("_bucket_count"), equalTo(3));
|
||||
Object[] propertiesKeys = (Object[]) ((InternalAggregation)histo).getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) ((InternalAggregation)histo).getProperty("_count");
|
||||
Object[] propertiesCounts = (Object[]) ((InternalAggregation)histo).getProperty("sum.value");
|
||||
|
||||
DateTime key = new DateTime(2012, 1, 1, 0, 0, DateTimeZone.UTC);
|
||||
Histogram.Bucket bucket = buckets.get(0);
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.DateScriptMocks.DateScriptsMockPlugin;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.Range;
|
||||
|
@ -419,10 +420,10 @@ public class DateRangeIT extends ESIntegTestCase {
|
|||
assertThat(range.getName(), equalTo("range"));
|
||||
List<? extends Bucket> buckets = range.getBuckets();
|
||||
assertThat(buckets.size(), equalTo(3));
|
||||
assertThat(range.getProperty("_bucket_count"), equalTo(3));
|
||||
Object[] propertiesKeys = (Object[]) range.getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) range.getProperty("_count");
|
||||
Object[] propertiesCounts = (Object[]) range.getProperty("sum.value");
|
||||
assertThat(((InternalAggregation)range).getProperty("_bucket_count"), equalTo(3));
|
||||
Object[] propertiesKeys = (Object[]) ((InternalAggregation)range).getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) ((InternalAggregation)range).getProperty("_count");
|
||||
Object[] propertiesCounts = (Object[]) ((InternalAggregation)range).getProperty("sum.value");
|
||||
|
||||
Range.Bucket bucket = buckets.get(0);
|
||||
assertThat(bucket, notNullValue());
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.elasticsearch.script.Script;
|
|||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
|
||||
import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
|
@ -467,10 +468,10 @@ public class DoubleTermsIT extends AbstractTermsTestCase {
|
|||
assertThat(terms, notNullValue());
|
||||
assertThat(terms.getName(), equalTo("terms"));
|
||||
assertThat(terms.getBuckets().size(), equalTo(5));
|
||||
assertThat(terms.getProperty("_bucket_count"), equalTo(5));
|
||||
Object[] propertiesKeys = (Object[]) terms.getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) terms.getProperty("_count");
|
||||
Object[] propertiesCounts = (Object[]) terms.getProperty("sum.value");
|
||||
assertThat(((InternalAggregation)terms).getProperty("_bucket_count"), equalTo(5));
|
||||
Object[] propertiesKeys = (Object[]) ((InternalAggregation)terms).getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) ((InternalAggregation)terms).getProperty("_count");
|
||||
Object[] propertiesCounts = (Object[]) ((InternalAggregation)terms).getProperty("sum.value");
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
Terms.Bucket bucket = terms.getBucketByKey("" + (double) i);
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.elasticsearch.action.search.SearchResponse;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
import org.elasticsearch.search.aggregations.metrics.avg.Avg;
|
||||
|
@ -128,7 +129,7 @@ public class FilterIT extends ESIntegTestCase {
|
|||
assertThat(filter, notNullValue());
|
||||
assertThat(filter.getName(), equalTo("tag1"));
|
||||
assertThat(filter.getDocCount(), equalTo((long) numTag1Docs));
|
||||
assertThat((long) filter.getProperty("_count"), equalTo((long) numTag1Docs));
|
||||
assertThat((long) ((InternalAggregation)filter).getProperty("_count"), equalTo((long) numTag1Docs));
|
||||
|
||||
long sum = 0;
|
||||
for (int i = 0; i < numTag1Docs; ++i) {
|
||||
|
@ -139,7 +140,7 @@ public class FilterIT extends ESIntegTestCase {
|
|||
assertThat(avgValue, notNullValue());
|
||||
assertThat(avgValue.getName(), equalTo("avg_value"));
|
||||
assertThat(avgValue.getValue(), equalTo((double) sum / numTag1Docs));
|
||||
assertThat((double) filter.getProperty("avg_value.value"), equalTo((double) sum / numTag1Docs));
|
||||
assertThat((double) ((InternalAggregation)filter).getProperty("avg_value.value"), equalTo((double) sum / numTag1Docs));
|
||||
}
|
||||
|
||||
public void testAsSubAggregation() {
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.elasticsearch.action.search.SearchResponse;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.filters.Filters;
|
||||
import org.elasticsearch.search.aggregations.bucket.filters.FiltersAggregator.KeyedFilter;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
|
@ -165,10 +166,10 @@ public class FiltersIT extends ESIntegTestCase {
|
|||
assertThat(filters.getName(), equalTo("tags"));
|
||||
|
||||
assertThat(filters.getBuckets().size(), equalTo(2));
|
||||
assertThat(filters.getProperty("_bucket_count"), equalTo(2));
|
||||
Object[] propertiesKeys = (Object[]) filters.getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) filters.getProperty("_count");
|
||||
Object[] propertiesCounts = (Object[]) filters.getProperty("avg_value.value");
|
||||
assertThat(((InternalAggregation)filters).getProperty("_bucket_count"), equalTo(2));
|
||||
Object[] propertiesKeys = (Object[]) ((InternalAggregation)filters).getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) ((InternalAggregation)filters).getProperty("_count");
|
||||
Object[] propertiesCounts = (Object[]) ((InternalAggregation)filters).getProperty("avg_value.value");
|
||||
|
||||
Filters.Bucket bucket = filters.getBucketByKey("tag1");
|
||||
assertThat(bucket, Matchers.notNullValue());
|
||||
|
@ -384,10 +385,10 @@ public class FiltersIT extends ESIntegTestCase {
|
|||
assertThat(filters.getName(), equalTo("tags"));
|
||||
|
||||
assertThat(filters.getBuckets().size(), equalTo(3));
|
||||
assertThat(filters.getProperty("_bucket_count"), equalTo(3));
|
||||
Object[] propertiesKeys = (Object[]) filters.getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) filters.getProperty("_count");
|
||||
Object[] propertiesCounts = (Object[]) filters.getProperty("avg_value.value");
|
||||
assertThat(((InternalAggregation)filters).getProperty("_bucket_count"), equalTo(3));
|
||||
Object[] propertiesKeys = (Object[]) ((InternalAggregation)filters).getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) ((InternalAggregation)filters).getProperty("_count");
|
||||
Object[] propertiesCounts = (Object[]) ((InternalAggregation)filters).getProperty("avg_value.value");
|
||||
|
||||
Filters.Bucket bucket = filters.getBucketByKey("tag1");
|
||||
assertThat(bucket, Matchers.notNullValue());
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.elasticsearch.common.unit.DistanceUnit;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.Range;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.Range.Bucket;
|
||||
|
@ -346,10 +347,10 @@ public class GeoDistanceIT extends ESIntegTestCase {
|
|||
assertThat(geoDist.getName(), equalTo("amsterdam_rings"));
|
||||
List<? extends Bucket> buckets = geoDist.getBuckets();
|
||||
assertThat(geoDist.getBuckets().size(), equalTo(3));
|
||||
assertThat(geoDist.getProperty("_bucket_count"), equalTo(3));
|
||||
Object[] propertiesKeys = (Object[]) geoDist.getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) geoDist.getProperty("_count");
|
||||
Object[] propertiesCities = (Object[]) geoDist.getProperty("cities");
|
||||
assertThat(((InternalAggregation)geoDist).getProperty("_bucket_count"), equalTo(3));
|
||||
Object[] propertiesKeys = (Object[]) ((InternalAggregation)geoDist).getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) ((InternalAggregation)geoDist).getProperty("_count");
|
||||
Object[] propertiesCities = (Object[]) ((InternalAggregation)geoDist).getProperty("cities");
|
||||
|
||||
Range.Bucket bucket = buckets.get(0);
|
||||
assertThat(bucket, notNullValue());
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.index.query.GeoBoundingBoxQueryBuilder;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilders;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.geogrid.GeoHashGrid;
|
||||
import org.elasticsearch.search.aggregations.bucket.geogrid.GeoHashGrid.Bucket;
|
||||
|
@ -157,8 +158,8 @@ public class GeoHashGridIT extends ESIntegTestCase {
|
|||
|
||||
GeoHashGrid geoGrid = response.getAggregations().get("geohashgrid");
|
||||
List<Bucket> buckets = geoGrid.getBuckets();
|
||||
Object[] propertiesKeys = (Object[]) geoGrid.getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) geoGrid.getProperty("_count");
|
||||
Object[] propertiesKeys = (Object[]) ((InternalAggregation)geoGrid).getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) ((InternalAggregation)geoGrid).getProperty("_count");
|
||||
for (int i = 0; i < buckets.size(); i++) {
|
||||
GeoHashGrid.Bucket cell = buckets.get(i);
|
||||
String geohash = cell.getKeyAsString();
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.elasticsearch.ElasticsearchException;
|
|||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
import org.elasticsearch.search.aggregations.metrics.stats.Stats;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
|
@ -82,11 +83,11 @@ public class GlobalIT extends ESIntegTestCase {
|
|||
assertThat(global, notNullValue());
|
||||
assertThat(global.getName(), equalTo("global"));
|
||||
assertThat(global.getDocCount(), equalTo((long) numDocs));
|
||||
assertThat((long) global.getProperty("_count"), equalTo((long) numDocs));
|
||||
assertThat((long) ((InternalAggregation)global).getProperty("_count"), equalTo((long) numDocs));
|
||||
assertThat(global.getAggregations().asList().isEmpty(), is(false));
|
||||
|
||||
Stats stats = global.getAggregations().get("value_stats");
|
||||
assertThat((Stats) global.getProperty("value_stats"), sameInstance(stats));
|
||||
assertThat((Stats) ((InternalAggregation)global).getProperty("value_stats"), sameInstance(stats));
|
||||
assertThat(stats, notNullValue());
|
||||
assertThat(stats.getName(), equalTo("value_stats"));
|
||||
long sum = 0;
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.elasticsearch.plugins.Plugin;
|
|||
import org.elasticsearch.script.MockScriptPlugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram.Bucket;
|
||||
|
@ -355,10 +356,10 @@ public class HistogramIT extends ESIntegTestCase {
|
|||
assertThat(histo, notNullValue());
|
||||
assertThat(histo.getName(), equalTo("histo"));
|
||||
assertThat(histo.getBuckets().size(), equalTo(numValueBuckets));
|
||||
assertThat(histo.getProperty("_bucket_count"), equalTo(numValueBuckets));
|
||||
Object[] propertiesKeys = (Object[]) histo.getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) histo.getProperty("_count");
|
||||
Object[] propertiesCounts = (Object[]) histo.getProperty("sum.value");
|
||||
assertThat(((InternalAggregation)histo).getProperty("_bucket_count"), equalTo(numValueBuckets));
|
||||
Object[] propertiesKeys = (Object[]) ((InternalAggregation)histo).getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) ((InternalAggregation)histo).getProperty("_count");
|
||||
Object[] propertiesCounts = (Object[]) ((InternalAggregation)histo).getProperty("sum.value");
|
||||
|
||||
// TODO: use diamond once JI-9019884 is fixed
|
||||
List<Histogram.Bucket> buckets = new ArrayList<>(histo.getBuckets());
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.elasticsearch.script.Script;
|
|||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
|
||||
import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
|
@ -475,9 +476,9 @@ public class LongTermsIT extends AbstractTermsTestCase {
|
|||
assertThat(terms, notNullValue());
|
||||
assertThat(terms.getName(), equalTo("terms"));
|
||||
assertThat(terms.getBuckets().size(), equalTo(5));
|
||||
Object[] propertiesKeys = (Object[]) terms.getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) terms.getProperty("_count");
|
||||
Object[] propertiesCounts = (Object[]) terms.getProperty("sum.value");
|
||||
Object[] propertiesKeys = (Object[]) ((InternalAggregation)terms).getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) ((InternalAggregation)terms).getProperty("_count");
|
||||
Object[] propertiesCounts = (Object[]) ((InternalAggregation)terms).getProperty("sum.value");
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
Terms.Bucket bucket = terms.getBucketByKey("" + i);
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.elasticsearch.search.aggregations.bucket;
|
|||
|
||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
import org.elasticsearch.search.aggregations.bucket.missing.Missing;
|
||||
import org.elasticsearch.search.aggregations.metrics.avg.Avg;
|
||||
|
@ -142,7 +143,7 @@ public class MissingIT extends ESIntegTestCase {
|
|||
assertThat(missing, notNullValue());
|
||||
assertThat(missing.getName(), equalTo("missing_tag"));
|
||||
assertThat(missing.getDocCount(), equalTo((long) numDocsMissing + numDocsUnmapped));
|
||||
assertThat((long) missing.getProperty("_count"), equalTo((long) numDocsMissing + numDocsUnmapped));
|
||||
assertThat((long) ((InternalAggregation)missing).getProperty("_count"), equalTo((long) numDocsMissing + numDocsUnmapped));
|
||||
assertThat(missing.getAggregations().asList().isEmpty(), is(false));
|
||||
|
||||
long sum = 0;
|
||||
|
@ -156,7 +157,7 @@ public class MissingIT extends ESIntegTestCase {
|
|||
assertThat(avgValue, notNullValue());
|
||||
assertThat(avgValue.getName(), equalTo("avg_value"));
|
||||
assertThat(avgValue.getValue(), equalTo((double) sum / (numDocsMissing + numDocsUnmapped)));
|
||||
assertThat((double) missing.getProperty("avg_value.value"), equalTo((double) sum / (numDocsMissing + numDocsUnmapped)));
|
||||
assertThat((double) ((InternalAggregation)missing).getProperty("avg_value.value"), equalTo((double) sum / (numDocsMissing + numDocsUnmapped)));
|
||||
}
|
||||
|
||||
public void testEmptyAggregation() throws Exception {
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
import org.elasticsearch.search.aggregations.bucket.nested.Nested;
|
||||
|
@ -245,7 +246,7 @@ public class NestedIT extends ESIntegTestCase {
|
|||
assertThat(nested, notNullValue());
|
||||
assertThat(nested.getName(), equalTo("nested"));
|
||||
assertThat(nested.getDocCount(), equalTo(docCount));
|
||||
assertThat(nested.getProperty("_count"), equalTo(docCount));
|
||||
assertThat(((InternalAggregation)nested).getProperty("_count"), equalTo(docCount));
|
||||
assertThat(nested.getAggregations().asList().isEmpty(), is(false));
|
||||
|
||||
LongTerms values = nested.getAggregations().get("values");
|
||||
|
@ -263,7 +264,7 @@ public class NestedIT extends ESIntegTestCase {
|
|||
assertEquals(counts[i], bucket.getDocCount());
|
||||
}
|
||||
}
|
||||
assertThat(nested.getProperty("values"), sameInstance(values));
|
||||
assertThat(((InternalAggregation)nested).getProperty("values"), sameInstance(values));
|
||||
}
|
||||
|
||||
public void testNestedAsSubAggregation() throws Exception {
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.elasticsearch.script.Script;
|
|||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
|
||||
import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.Range;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.Range.Bucket;
|
||||
|
@ -334,9 +335,9 @@ public class RangeIT extends ESIntegTestCase {
|
|||
assertThat(range.getName(), equalTo("range"));
|
||||
List<? extends Bucket> buckets = range.getBuckets();
|
||||
assertThat(range.getBuckets().size(), equalTo(3));
|
||||
Object[] propertiesKeys = (Object[]) range.getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) range.getProperty("_count");
|
||||
Object[] propertiesCounts = (Object[]) range.getProperty("sum.value");
|
||||
Object[] propertiesKeys = (Object[]) ((InternalAggregation)range).getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) ((InternalAggregation)range).getProperty("_count");
|
||||
Object[] propertiesCounts = (Object[]) ((InternalAggregation)range).getProperty("sum.value");
|
||||
|
||||
Range.Bucket bucket = buckets.get(0);
|
||||
assertThat(bucket, notNullValue());
|
||||
|
|
|
@ -23,13 +23,13 @@ import org.elasticsearch.action.search.SearchResponse;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.nested.Nested;
|
||||
import org.elasticsearch.search.aggregations.bucket.nested.ReverseNested;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.hamcrest.Matchers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -167,9 +167,9 @@ public class ReverseNestedIT extends ESIntegTestCase {
|
|||
assertThat(bucket.getKeyAsString(), equalTo("1"));
|
||||
assertThat(bucket.getDocCount(), equalTo(6L));
|
||||
ReverseNested reverseNested = bucket.getAggregations().get("nested1_to_field1");
|
||||
assertThat(reverseNested.getProperty("_count"), equalTo(5L));
|
||||
assertThat(((InternalAggregation)reverseNested).getProperty("_count"), equalTo(5L));
|
||||
Terms tags = reverseNested.getAggregations().get("field1");
|
||||
assertThat(reverseNested.getProperty("field1"), sameInstance(tags));
|
||||
assertThat(((InternalAggregation)reverseNested).getProperty("field1"), sameInstance(tags));
|
||||
List<Terms.Bucket> tagsBuckets = new ArrayList<>(tags.getBuckets());
|
||||
assertThat(tagsBuckets.size(), equalTo(6));
|
||||
assertThat(tagsBuckets.get(0).getKeyAsString(), equalTo("c"));
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.elasticsearch.script.ScriptType;
|
|||
import org.elasticsearch.search.aggregations.AggregationExecutionException;
|
||||
import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
|
||||
import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
|
@ -256,8 +257,8 @@ public class StringTermsIT extends AbstractTermsTestCase {
|
|||
assertThat(terms, notNullValue());
|
||||
assertThat(terms.getName(), equalTo("terms"));
|
||||
assertThat(terms.getBuckets().size(), equalTo(5));
|
||||
Object[] propertiesKeys = (Object[]) terms.getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) terms.getProperty("_count");
|
||||
Object[] propertiesKeys = (Object[]) ((InternalAggregation)terms).getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) ((InternalAggregation)terms).getProperty("_count");
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
Terms.Bucket bucket = terms.getBucketByKey("val" + i);
|
||||
|
@ -589,9 +590,9 @@ public class StringTermsIT extends AbstractTermsTestCase {
|
|||
assertThat(terms, notNullValue());
|
||||
assertThat(terms.getName(), equalTo("terms"));
|
||||
assertThat(terms.getBuckets().size(), equalTo(5));
|
||||
Object[] propertiesKeys = (Object[]) terms.getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) terms.getProperty("_count");
|
||||
Object[] propertiesCounts = (Object[]) terms.getProperty("count.value");
|
||||
Object[] propertiesKeys = (Object[]) ((InternalAggregation)terms).getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) ((InternalAggregation)terms).getProperty("_count");
|
||||
Object[] propertiesCounts = (Object[]) ((InternalAggregation)terms).getProperty("count.value");
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
Terms.Bucket bucket = terms.getBucketByKey("val" + i);
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.elasticsearch.index.mapper.NumberFieldMapper;
|
|||
import org.elasticsearch.index.mapper.TypeFieldMapper;
|
||||
import org.elasticsearch.index.mapper.UidFieldMapper;
|
||||
import org.elasticsearch.search.aggregations.AggregatorTestCase;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.metrics.max.InternalMax;
|
||||
import org.elasticsearch.search.aggregations.metrics.max.MaxAggregationBuilder;
|
||||
|
||||
|
@ -68,11 +69,13 @@ public class ReverseNestedAggregatorTests extends AggregatorTestCase {
|
|||
|
||||
Nested nested = search(newSearcher(indexReader, true, true),
|
||||
new MatchAllDocsQuery(), nestedBuilder, fieldType);
|
||||
ReverseNested reverseNested = (ReverseNested) nested.getProperty(REVERSE_AGG_NAME);
|
||||
ReverseNested reverseNested = (ReverseNested)
|
||||
((InternalAggregation)nested).getProperty(REVERSE_AGG_NAME);
|
||||
assertEquals(REVERSE_AGG_NAME, reverseNested.getName());
|
||||
assertEquals(0, reverseNested.getDocCount());
|
||||
|
||||
InternalMax max = (InternalMax) reverseNested.getProperty(MAX_AGG_NAME);
|
||||
InternalMax max = (InternalMax)
|
||||
((InternalAggregation)reverseNested).getProperty(MAX_AGG_NAME);
|
||||
assertEquals(MAX_AGG_NAME, max.getName());
|
||||
assertEquals(Double.NEGATIVE_INFINITY, max.getValue(), Double.MIN_VALUE);
|
||||
}
|
||||
|
@ -131,11 +134,13 @@ public class ReverseNestedAggregatorTests extends AggregatorTestCase {
|
|||
new MatchAllDocsQuery(), nestedBuilder, fieldType);
|
||||
assertEquals(expectedNestedDocs, nested.getDocCount());
|
||||
|
||||
ReverseNested reverseNested = (ReverseNested) nested.getProperty(REVERSE_AGG_NAME);
|
||||
ReverseNested reverseNested = (ReverseNested)
|
||||
((InternalAggregation)nested).getProperty(REVERSE_AGG_NAME);
|
||||
assertEquals(REVERSE_AGG_NAME, reverseNested.getName());
|
||||
assertEquals(expectedParentDocs, reverseNested.getDocCount());
|
||||
|
||||
InternalMax max = (InternalMax) reverseNested.getProperty(MAX_AGG_NAME);
|
||||
InternalMax max = (InternalMax)
|
||||
((InternalAggregation)reverseNested).getProperty(MAX_AGG_NAME);
|
||||
assertEquals(MAX_AGG_NAME, max.getName());
|
||||
assertEquals(expectedMaxValue, max.getValue(), Double.MIN_VALUE);
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.elasticsearch.script.Script;
|
|||
import org.elasticsearch.script.ScriptEngineService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.script.SearchScript;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
|
@ -142,9 +143,9 @@ public class AvgIT extends AbstractNumericTestCase {
|
|||
assertThat(avg.getName(), equalTo("avg"));
|
||||
double expectedAvgValue = (double) (1+2+3+4+5+6+7+8+9+10) / 10;
|
||||
assertThat(avg.getValue(), equalTo(expectedAvgValue));
|
||||
assertThat((Avg) global.getProperty("avg"), equalTo(avg));
|
||||
assertThat((double) global.getProperty("avg.value"), equalTo(expectedAvgValue));
|
||||
assertThat((double) avg.getProperty("value"), equalTo(expectedAvgValue));
|
||||
assertThat((Avg) ((InternalAggregation)global).getProperty("avg"), equalTo(avg));
|
||||
assertThat((double) ((InternalAggregation)global).getProperty("avg.value"), equalTo(expectedAvgValue));
|
||||
assertThat((double) ((InternalAggregation)avg).getProperty("value"), equalTo(expectedAvgValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.elasticsearch.script.MockScriptPlugin;
|
|||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
import org.elasticsearch.search.aggregations.metrics.cardinality.Cardinality;
|
||||
|
@ -244,9 +245,9 @@ public class CardinalityIT extends ESIntegTestCase {
|
|||
assertThat(cardinality.getName(), equalTo("cardinality"));
|
||||
long expectedValue = numDocs;
|
||||
assertCount(cardinality, expectedValue);
|
||||
assertThat((Cardinality) global.getProperty("cardinality"), equalTo(cardinality));
|
||||
assertThat((double) global.getProperty("cardinality.value"), equalTo((double) cardinality.getValue()));
|
||||
assertThat((double) cardinality.getProperty("value"), equalTo((double) cardinality.getValue()));
|
||||
assertThat(((InternalAggregation)global).getProperty("cardinality"), equalTo(cardinality));
|
||||
assertThat(((InternalAggregation)global).getProperty("cardinality.value"), equalTo((double) cardinality.getValue()));
|
||||
assertThat((double) ((InternalAggregation)cardinality).getProperty("value"), equalTo((double) cardinality.getValue()));
|
||||
}
|
||||
|
||||
public void testSingleValuedNumericHashed() throws Exception {
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.elasticsearch.plugins.Plugin;
|
|||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
|
@ -240,33 +241,33 @@ public class ExtendedStatsIT extends AbstractNumericTestCase {
|
|||
ExtendedStats stats = global.getAggregations().get("stats");
|
||||
assertThat(stats, notNullValue());
|
||||
assertThat(stats.getName(), equalTo("stats"));
|
||||
ExtendedStats statsFromProperty = (ExtendedStats) global.getProperty("stats");
|
||||
ExtendedStats statsFromProperty = (ExtendedStats) ((InternalAggregation)global).getProperty("stats");
|
||||
assertThat(statsFromProperty, notNullValue());
|
||||
assertThat(statsFromProperty, sameInstance(stats));
|
||||
double expectedAvgValue = (double) (1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10) / 10;
|
||||
assertThat(stats.getAvg(), equalTo(expectedAvgValue));
|
||||
assertThat((double) global.getProperty("stats.avg"), equalTo(expectedAvgValue));
|
||||
assertThat((double) ((InternalAggregation)global).getProperty("stats.avg"), equalTo(expectedAvgValue));
|
||||
double expectedMinValue = 1.0;
|
||||
assertThat(stats.getMin(), equalTo(expectedMinValue));
|
||||
assertThat((double) global.getProperty("stats.min"), equalTo(expectedMinValue));
|
||||
assertThat((double) ((InternalAggregation)global).getProperty("stats.min"), equalTo(expectedMinValue));
|
||||
double expectedMaxValue = 10.0;
|
||||
assertThat(stats.getMax(), equalTo(expectedMaxValue));
|
||||
assertThat((double) global.getProperty("stats.max"), equalTo(expectedMaxValue));
|
||||
assertThat((double) ((InternalAggregation)global).getProperty("stats.max"), equalTo(expectedMaxValue));
|
||||
double expectedSumValue = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10;
|
||||
assertThat(stats.getSum(), equalTo(expectedSumValue));
|
||||
assertThat((double) global.getProperty("stats.sum"), equalTo(expectedSumValue));
|
||||
assertThat((double) ((InternalAggregation)global).getProperty("stats.sum"), equalTo(expectedSumValue));
|
||||
long expectedCountValue = 10;
|
||||
assertThat(stats.getCount(), equalTo(expectedCountValue));
|
||||
assertThat((double) global.getProperty("stats.count"), equalTo((double) expectedCountValue));
|
||||
assertThat((double) ((InternalAggregation)global).getProperty("stats.count"), equalTo((double) expectedCountValue));
|
||||
double expectedSumOfSquaresValue = (double) 1 + 4 + 9 + 16 + 25 + 36 + 49 + 64 + 81 + 100;
|
||||
assertThat(stats.getSumOfSquares(), equalTo(expectedSumOfSquaresValue));
|
||||
assertThat((double) global.getProperty("stats.sum_of_squares"), equalTo(expectedSumOfSquaresValue));
|
||||
assertThat((double) ((InternalAggregation)global).getProperty("stats.sum_of_squares"), equalTo(expectedSumOfSquaresValue));
|
||||
double expectedVarianceValue = variance(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
|
||||
assertThat(stats.getVariance(), equalTo(expectedVarianceValue));
|
||||
assertThat((double) global.getProperty("stats.variance"), equalTo(expectedVarianceValue));
|
||||
assertThat((double) ((InternalAggregation)global).getProperty("stats.variance"), equalTo(expectedVarianceValue));
|
||||
double expectedStdDevValue = stdDev(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
|
||||
assertThat(stats.getStdDeviation(), equalTo(expectedStdDevValue));
|
||||
assertThat((double) global.getProperty("stats.std_deviation"), equalTo(expectedStdDevValue));
|
||||
assertThat((double) ((InternalAggregation)global).getProperty("stats.std_deviation"), equalTo(expectedStdDevValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.elasticsearch.search.aggregations.metrics;
|
|||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.common.geo.GeoPoint;
|
||||
import org.elasticsearch.common.util.BigArray;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket;
|
||||
|
@ -87,17 +88,19 @@ public class GeoBoundsIT extends AbstractGeoTestCase {
|
|||
GeoBounds geobounds = global.getAggregations().get(aggName);
|
||||
assertThat(geobounds, notNullValue());
|
||||
assertThat(geobounds.getName(), equalTo(aggName));
|
||||
assertThat((GeoBounds) global.getProperty(aggName), sameInstance(geobounds));
|
||||
assertThat((GeoBounds) ((InternalAggregation)global).getProperty(aggName), sameInstance(geobounds));
|
||||
GeoPoint topLeft = geobounds.topLeft();
|
||||
GeoPoint bottomRight = geobounds.bottomRight();
|
||||
assertThat(topLeft.lat(), closeTo(singleTopLeft.lat(), GEOHASH_TOLERANCE));
|
||||
assertThat(topLeft.lon(), closeTo(singleTopLeft.lon(), GEOHASH_TOLERANCE));
|
||||
assertThat(bottomRight.lat(), closeTo(singleBottomRight.lat(), GEOHASH_TOLERANCE));
|
||||
assertThat(bottomRight.lon(), closeTo(singleBottomRight.lon(), GEOHASH_TOLERANCE));
|
||||
assertThat((double) global.getProperty(aggName + ".top"), closeTo(singleTopLeft.lat(), GEOHASH_TOLERANCE));
|
||||
assertThat((double) global.getProperty(aggName + ".left"), closeTo(singleTopLeft.lon(), GEOHASH_TOLERANCE));
|
||||
assertThat((double) global.getProperty(aggName + ".bottom"), closeTo(singleBottomRight.lat(), GEOHASH_TOLERANCE));
|
||||
assertThat((double) global.getProperty(aggName + ".right"), closeTo(singleBottomRight.lon(), GEOHASH_TOLERANCE));
|
||||
assertThat((double) ((InternalAggregation)global).getProperty(aggName + ".top"), closeTo(singleTopLeft.lat(), GEOHASH_TOLERANCE));
|
||||
assertThat((double) ((InternalAggregation)global).getProperty(aggName + ".left"), closeTo(singleTopLeft.lon(), GEOHASH_TOLERANCE));
|
||||
assertThat((double) ((InternalAggregation)global).getProperty(aggName + ".bottom"),
|
||||
closeTo(singleBottomRight.lat(), GEOHASH_TOLERANCE));
|
||||
assertThat((double) ((InternalAggregation)global).getProperty(aggName + ".right"),
|
||||
closeTo(singleBottomRight.lon(), GEOHASH_TOLERANCE));
|
||||
}
|
||||
|
||||
public void testMultiValuedField() throws Exception {
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.elasticsearch.search.aggregations.metrics;
|
|||
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.common.geo.GeoPoint;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.geogrid.GeoHashGrid;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
import org.elasticsearch.search.aggregations.metrics.geocentroid.GeoCentroid;
|
||||
|
@ -119,14 +120,16 @@ public class GeoCentroidIT extends AbstractGeoTestCase {
|
|||
GeoCentroid geoCentroid = global.getAggregations().get(aggName);
|
||||
assertThat(geoCentroid, notNullValue());
|
||||
assertThat(geoCentroid.getName(), equalTo(aggName));
|
||||
assertThat((GeoCentroid) global.getProperty(aggName), sameInstance(geoCentroid));
|
||||
assertThat((GeoCentroid) ((InternalAggregation)global).getProperty(aggName), sameInstance(geoCentroid));
|
||||
GeoPoint centroid = geoCentroid.centroid();
|
||||
assertThat(centroid.lat(), closeTo(singleCentroid.lat(), GEOHASH_TOLERANCE));
|
||||
assertThat(centroid.lon(), closeTo(singleCentroid.lon(), GEOHASH_TOLERANCE));
|
||||
assertThat(((GeoPoint) global.getProperty(aggName + ".value")).lat(), closeTo(singleCentroid.lat(), GEOHASH_TOLERANCE));
|
||||
assertThat(((GeoPoint) global.getProperty(aggName + ".value")).lon(), closeTo(singleCentroid.lon(), GEOHASH_TOLERANCE));
|
||||
assertThat((double) global.getProperty(aggName + ".lat"), closeTo(singleCentroid.lat(), GEOHASH_TOLERANCE));
|
||||
assertThat((double) global.getProperty(aggName + ".lon"), closeTo(singleCentroid.lon(), GEOHASH_TOLERANCE));
|
||||
assertThat(((GeoPoint) ((InternalAggregation)global).getProperty(aggName + ".value")).lat(),
|
||||
closeTo(singleCentroid.lat(), GEOHASH_TOLERANCE));
|
||||
assertThat(((GeoPoint) ((InternalAggregation)global).getProperty(aggName + ".value")).lon(),
|
||||
closeTo(singleCentroid.lon(), GEOHASH_TOLERANCE));
|
||||
assertThat((double) ((InternalAggregation)global).getProperty(aggName + ".lat"), closeTo(singleCentroid.lat(), GEOHASH_TOLERANCE));
|
||||
assertThat((double) ((InternalAggregation)global).getProperty(aggName + ".lon"), closeTo(singleCentroid.lon(), GEOHASH_TOLERANCE));
|
||||
}
|
||||
|
||||
public void testMultiValuedField() throws Exception {
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.elasticsearch.plugins.Plugin;
|
|||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
|
@ -209,7 +210,7 @@ public class HDRPercentileRanksIT extends AbstractNumericTestCase {
|
|||
PercentileRanks values = global.getAggregations().get("percentile_ranks");
|
||||
assertThat(values, notNullValue());
|
||||
assertThat(values.getName(), equalTo("percentile_ranks"));
|
||||
assertThat(global.getProperty("percentile_ranks"), sameInstance(values));
|
||||
assertThat(((InternalAggregation)global).getProperty("percentile_ranks"), sameInstance(values));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.elasticsearch.plugins.Plugin;
|
|||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
|
@ -211,7 +212,7 @@ public class HDRPercentilesIT extends AbstractNumericTestCase {
|
|||
Percentiles percentiles = global.getAggregations().get("percentiles");
|
||||
assertThat(percentiles, notNullValue());
|
||||
assertThat(percentiles.getName(), equalTo("percentiles"));
|
||||
assertThat(global.getProperty("percentiles"), sameInstance(percentiles));
|
||||
assertThat(((InternalAggregation)global).getProperty("percentiles"), sameInstance(percentiles));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.elasticsearch.plugins.Plugin;
|
|||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
|
@ -138,9 +139,9 @@ public class MaxIT extends AbstractNumericTestCase {
|
|||
assertThat(max.getName(), equalTo("max"));
|
||||
double expectedMaxValue = 10.0;
|
||||
assertThat(max.getValue(), equalTo(expectedMaxValue));
|
||||
assertThat((Max) global.getProperty("max"), equalTo(max));
|
||||
assertThat((double) global.getProperty("max.value"), equalTo(expectedMaxValue));
|
||||
assertThat((double) max.getProperty("value"), equalTo(expectedMaxValue));
|
||||
assertThat((Max) ((InternalAggregation)global).getProperty("max"), equalTo(max));
|
||||
assertThat((double) ((InternalAggregation)global).getProperty("max.value"), equalTo(expectedMaxValue));
|
||||
assertThat((double) ((InternalAggregation)max).getProperty("value"), equalTo(expectedMaxValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.elasticsearch.plugins.Plugin;
|
|||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
|
@ -139,9 +140,9 @@ public class MinIT extends AbstractNumericTestCase {
|
|||
assertThat(min.getName(), equalTo("min"));
|
||||
double expectedMinValue = 1.0;
|
||||
assertThat(min.getValue(), equalTo(expectedMinValue));
|
||||
assertThat((Min) global.getProperty("min"), equalTo(min));
|
||||
assertThat((double) global.getProperty("min.value"), equalTo(expectedMinValue));
|
||||
assertThat((double) min.getProperty("value"), equalTo(expectedMinValue));
|
||||
assertThat((Min) ((InternalAggregation)global).getProperty("min"), equalTo(min));
|
||||
assertThat((double) ((InternalAggregation)global).getProperty("min.value"), equalTo(expectedMinValue));
|
||||
assertThat((double) ((InternalAggregation)min).getProperty("value"), equalTo(expectedMinValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.elasticsearch.script.Script;
|
|||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.Aggregation;
|
||||
import org.elasticsearch.search.aggregations.Aggregations;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram.Bucket;
|
||||
|
@ -600,10 +601,9 @@ public class ScriptedMetricIT extends ESIntegTestCase {
|
|||
assertThat(object, notNullValue());
|
||||
assertThat(object, instanceOf(Number.class));
|
||||
assertThat(((Number) object).longValue(), equalTo(numDocs * 3));
|
||||
assertThat((ScriptedMetric) global.getProperty("scripted"), sameInstance(scriptedMetricAggregation));
|
||||
assertThat((List) global.getProperty("scripted.value"), sameInstance((List) aggregationList));
|
||||
assertThat((List) scriptedMetricAggregation.getProperty("value"), sameInstance((List) aggregationList));
|
||||
|
||||
assertThat(((InternalAggregation)global).getProperty("scripted"), sameInstance(scriptedMetricAggregation));
|
||||
assertThat((List) ((InternalAggregation)global).getProperty("scripted.value"), sameInstance((List) aggregationList));
|
||||
assertThat((List) ((InternalAggregation)scriptedMetricAggregation).getProperty("value"), sameInstance((List) aggregationList));
|
||||
}
|
||||
|
||||
public void testMapCombineReduceWithParams() {
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.elasticsearch.plugins.Plugin;
|
|||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
|
@ -181,24 +182,24 @@ public class StatsIT extends AbstractNumericTestCase {
|
|||
Stats stats = global.getAggregations().get("stats");
|
||||
assertThat(stats, notNullValue());
|
||||
assertThat(stats.getName(), equalTo("stats"));
|
||||
Stats statsFromProperty = (Stats) global.getProperty("stats");
|
||||
Stats statsFromProperty = (Stats) ((InternalAggregation)global).getProperty("stats");
|
||||
assertThat(statsFromProperty, notNullValue());
|
||||
assertThat(statsFromProperty, sameInstance(stats));
|
||||
double expectedAvgValue = (double) (1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10) / 10;
|
||||
assertThat(stats.getAvg(), equalTo(expectedAvgValue));
|
||||
assertThat((double) global.getProperty("stats.avg"), equalTo(expectedAvgValue));
|
||||
assertThat((double) ((InternalAggregation)global).getProperty("stats.avg"), equalTo(expectedAvgValue));
|
||||
double expectedMinValue = 1.0;
|
||||
assertThat(stats.getMin(), equalTo(expectedMinValue));
|
||||
assertThat((double) global.getProperty("stats.min"), equalTo(expectedMinValue));
|
||||
assertThat((double) ((InternalAggregation)global).getProperty("stats.min"), equalTo(expectedMinValue));
|
||||
double expectedMaxValue = 10.0;
|
||||
assertThat(stats.getMax(), equalTo(expectedMaxValue));
|
||||
assertThat((double) global.getProperty("stats.max"), equalTo(expectedMaxValue));
|
||||
assertThat((double) ((InternalAggregation)global).getProperty("stats.max"), equalTo(expectedMaxValue));
|
||||
double expectedSumValue = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10;
|
||||
assertThat(stats.getSum(), equalTo(expectedSumValue));
|
||||
assertThat((double) global.getProperty("stats.sum"), equalTo(expectedSumValue));
|
||||
assertThat((double) ((InternalAggregation)global).getProperty("stats.sum"), equalTo(expectedSumValue));
|
||||
long expectedCountValue = 10;
|
||||
assertThat(stats.getCount(), equalTo(expectedCountValue));
|
||||
assertThat((double) global.getProperty("stats.count"), equalTo((double) expectedCountValue));
|
||||
assertThat((double) ((InternalAggregation)global).getProperty("stats.count"), equalTo((double) expectedCountValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.elasticsearch.script.Script;
|
|||
import org.elasticsearch.script.ScriptEngineService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.script.SearchScript;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
|
@ -152,9 +153,9 @@ public class SumIT extends AbstractNumericTestCase {
|
|||
assertThat(sum.getName(), equalTo("sum"));
|
||||
double expectedSumValue = (double) 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10;
|
||||
assertThat(sum.getValue(), equalTo(expectedSumValue));
|
||||
assertThat((Sum) global.getProperty("sum"), equalTo(sum));
|
||||
assertThat((double) global.getProperty("sum.value"), equalTo(expectedSumValue));
|
||||
assertThat((double) sum.getProperty("value"), equalTo(expectedSumValue));
|
||||
assertThat((Sum) ((InternalAggregation)global).getProperty("sum"), equalTo(sum));
|
||||
assertThat((double) ((InternalAggregation)global).getProperty("sum.value"), equalTo(expectedSumValue));
|
||||
assertThat((double) ((InternalAggregation)sum).getProperty("value"), equalTo(expectedSumValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.elasticsearch.plugins.Plugin;
|
|||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
|
@ -42,6 +43,7 @@ import java.util.Collections;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.termQuery;
|
||||
|
@ -198,7 +200,7 @@ public class TDigestPercentileRanksIT extends AbstractNumericTestCase {
|
|||
PercentileRanks values = global.getAggregations().get("percentile_ranks");
|
||||
assertThat(values, notNullValue());
|
||||
assertThat(values.getName(), equalTo("percentile_ranks"));
|
||||
assertThat(global.getProperty("percentile_ranks"), sameInstance(values));
|
||||
assertThat(((InternalAggregation)global).getProperty("percentile_ranks"), sameInstance(values));
|
||||
}
|
||||
|
||||
public void testSingleValuedFieldOutsideRange() throws Exception {
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.elasticsearch.plugins.Plugin;
|
|||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
|
@ -198,7 +199,7 @@ public class TDigestPercentilesIT extends AbstractNumericTestCase {
|
|||
Percentiles percentiles = global.getAggregations().get("percentiles");
|
||||
assertThat(percentiles, notNullValue());
|
||||
assertThat(percentiles.getName(), equalTo("percentiles"));
|
||||
assertThat(global.getProperty("percentiles"), sameInstance(percentiles));
|
||||
assertThat(((InternalAggregation)global).getProperty("percentiles"), sameInstance(percentiles));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.elasticsearch.search.SearchHit;
|
|||
import org.elasticsearch.search.SearchHitField;
|
||||
import org.elasticsearch.search.SearchHits;
|
||||
import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
import org.elasticsearch.search.aggregations.bucket.nested.Nested;
|
||||
|
@ -48,8 +49,8 @@ import org.elasticsearch.search.aggregations.metrics.max.Max;
|
|||
import org.elasticsearch.search.aggregations.metrics.tophits.TopHits;
|
||||
import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder;
|
||||
import org.elasticsearch.search.fetch.subphase.highlight.HighlightField;
|
||||
import org.elasticsearch.search.sort.ScriptSortBuilder.ScriptSortType;
|
||||
import org.elasticsearch.search.rescore.RescoreBuilder;
|
||||
import org.elasticsearch.search.sort.ScriptSortBuilder.ScriptSortType;
|
||||
import org.elasticsearch.search.sort.SortBuilders;
|
||||
import org.elasticsearch.search.sort.SortOrder;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
|
@ -440,7 +441,7 @@ public class TopHitsIT extends ESIntegTestCase {
|
|||
TopHits topHits = global.getAggregations().get("hits");
|
||||
assertThat(topHits, notNullValue());
|
||||
assertThat(topHits.getName(), equalTo("hits"));
|
||||
assertThat((TopHits) global.getProperty("hits"), sameInstance(topHits));
|
||||
assertThat((TopHits) ((InternalAggregation)global).getProperty("hits"), sameInstance(topHits));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.elasticsearch.script.Script;
|
|||
import org.elasticsearch.script.ScriptEngineService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.script.SearchScript;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount;
|
||||
import org.elasticsearch.search.lookup.LeafSearchLookup;
|
||||
|
@ -122,9 +123,9 @@ public class ValueCountIT extends ESIntegTestCase {
|
|||
assertThat(valueCount, notNullValue());
|
||||
assertThat(valueCount.getName(), equalTo("count"));
|
||||
assertThat(valueCount.getValue(), equalTo(10L));
|
||||
assertThat((ValueCount) global.getProperty("count"), equalTo(valueCount));
|
||||
assertThat((double) global.getProperty("count.value"), equalTo(10d));
|
||||
assertThat((double) valueCount.getProperty("value"), equalTo(10d));
|
||||
assertThat((ValueCount) ((InternalAggregation)global).getProperty("count"), equalTo(valueCount));
|
||||
assertThat((double) ((InternalAggregation)global).getProperty("count.value"), equalTo(10d));
|
||||
assertThat((double) ((InternalAggregation)valueCount).getProperty("value"), equalTo(10d));
|
||||
}
|
||||
|
||||
public void testSingleValuedFieldPartiallyUnmapped() throws Exception {
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.elasticsearch.search.aggregations.pipeline;
|
|||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.index.mapper.DateFieldMapper;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram.Bucket;
|
||||
|
@ -349,9 +350,9 @@ public class DateDerivativeIT extends ESIntegTestCase {
|
|||
assertThat(histo.getName(), equalTo("histo"));
|
||||
List<? extends Bucket> buckets = histo.getBuckets();
|
||||
assertThat(buckets.size(), equalTo(3));
|
||||
Object[] propertiesKeys = (Object[]) histo.getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) histo.getProperty("_count");
|
||||
Object[] propertiesCounts = (Object[]) histo.getProperty("sum.value");
|
||||
Object[] propertiesKeys = (Object[]) ((InternalAggregation)histo).getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) ((InternalAggregation)histo).getProperty("_count");
|
||||
Object[] propertiesCounts = (Object[]) ((InternalAggregation)histo).getProperty("sum.value");
|
||||
|
||||
DateTime key = new DateTime(2012, 1, 1, 0, 0, DateTimeZone.UTC);
|
||||
Histogram.Bucket bucket = buckets.get(0);
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.elasticsearch.action.search.SearchPhaseExecutionException;
|
|||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram.Bucket;
|
||||
import org.elasticsearch.search.aggregations.metrics.stats.Stats;
|
||||
|
@ -259,9 +260,9 @@ public class DerivativeIT extends ESIntegTestCase {
|
|||
assertThat(deriv, notNullValue());
|
||||
assertThat(deriv.getName(), equalTo("histo"));
|
||||
assertThat(deriv.getBuckets().size(), equalTo(numValueBuckets));
|
||||
Object[] propertiesKeys = (Object[]) deriv.getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) deriv.getProperty("_count");
|
||||
Object[] propertiesSumCounts = (Object[]) deriv.getProperty("sum.value");
|
||||
Object[] propertiesKeys = (Object[]) ((InternalAggregation)deriv).getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) ((InternalAggregation)deriv).getProperty("_count");
|
||||
Object[] propertiesSumCounts = (Object[]) ((InternalAggregation)deriv).getProperty("sum.value");
|
||||
|
||||
List<Bucket> buckets = new ArrayList<Bucket>(deriv.getBuckets());
|
||||
Long expectedSumPreviousBucket = Long.MIN_VALUE; // start value, gets
|
||||
|
@ -304,9 +305,9 @@ public class DerivativeIT extends ESIntegTestCase {
|
|||
assertThat(deriv, notNullValue());
|
||||
assertThat(deriv.getName(), equalTo("histo"));
|
||||
assertThat(deriv.getBuckets().size(), equalTo(numValueBuckets));
|
||||
Object[] propertiesKeys = (Object[]) deriv.getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) deriv.getProperty("_count");
|
||||
Object[] propertiesSumCounts = (Object[]) deriv.getProperty("stats.sum");
|
||||
Object[] propertiesKeys = (Object[]) ((InternalAggregation)deriv).getProperty("_key");
|
||||
Object[] propertiesDocCounts = (Object[]) ((InternalAggregation)deriv).getProperty("_count");
|
||||
Object[] propertiesSumCounts = (Object[]) ((InternalAggregation)deriv).getProperty("stats.sum");
|
||||
|
||||
List<Bucket> buckets = new ArrayList<Bucket>(deriv.getBuckets());
|
||||
Long expectedSumPreviousBucket = Long.MIN_VALUE; // start value, gets
|
||||
|
|
Loading…
Reference in New Issue