"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "server/src/test/java/org/elasticsearch/search/aggregations/metrics/MaxIT.java" between
elasticsearch-6.8.2-src.tar.gz and elasticsearch-6.8.3-src.tar.gz

About: elasticsearch is a Distributed, RESTful, Search Engine built on top of Apache Lucene. Source package (GitHub).

MaxIT.java  (elasticsearch-6.8.2-src):MaxIT.java  (elasticsearch-6.8.3-src)
skipping to change at line 27 skipping to change at line 27
* under the License. * under the License.
*/ */
package org.elasticsearch.search.aggregations.metrics; package org.elasticsearch.search.aggregations.metrics;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.script.Script; import org.elasticsearch.script.Script;
import org.elasticsearch.script.ScriptType; import org.elasticsearch.script.ScriptType;
import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin; import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.bucket.filter.Filter; import org.elasticsearch.search.aggregations.bucket.filter.Filter;
import org.elasticsearch.search.aggregations.bucket.global.Global; import org.elasticsearch.search.aggregations.bucket.global.Global;
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram; import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
import org.elasticsearch.search.aggregations.bucket.terms.Terms; import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.aggregations.metrics.max.InternalMax;
import org.elasticsearch.search.aggregations.metrics.max.Max; import org.elasticsearch.search.aggregations.metrics.max.Max;
import org.elasticsearch.search.aggregations.BucketOrder; import org.elasticsearch.search.aggregations.BucketOrder;
import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount; import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
skipping to change at line 416 skipping to change at line 418
Max max = searchResponse.getAggregations().get("max"); Max max = searchResponse.getAggregations().get("max");
assertThat(max, notNullValue()); assertThat(max, notNullValue());
assertThat(max.getName(), equalTo("max")); assertThat(max.getName(), equalTo("max"));
assertThat(max.getValue(), equalTo(12.0)); assertThat(max.getValue(), equalTo(12.0));
ValueCount count = searchResponse.getAggregations().get("count"); ValueCount count = searchResponse.getAggregations().get("count");
assertThat(count.getName(), equalTo("count")); assertThat(count.getName(), equalTo("count"));
assertThat(count.getValue(), equalTo(20L)); assertThat(count.getValue(), equalTo(20L));
} }
public void testNestedEarlyTermination() throws Exception {
for (Aggregator.SubAggCollectionMode collectionMode : Aggregator.SubAggC
ollectionMode.values()) {
SearchResponse searchResponse = client().prepareSearch("idx")
.setTrackTotalHits(false)
.setQuery(matchAllQuery())
.addAggregation(max("max").field("values"))
.addAggregation(count("count").field("values"))
.addAggregation(terms("terms").field("value")
.collectMode(collectionMode)
.subAggregation(max("sub_max").field("invalid")))
.get();
Max max = searchResponse.getAggregations().get("max");
assertThat(max, notNullValue());
assertThat(max.getName(), equalTo("max"));
assertThat(max.getValue(), equalTo(12.0));
ValueCount count = searchResponse.getAggregations().get("count");
assertThat(count.getName(), equalTo("count"));
assertThat(count.getValue(), equalTo(20L));
Terms terms = searchResponse.getAggregations().get("terms");
assertThat(terms.getBuckets().size(), equalTo(10));
for (Terms.Bucket b : terms.getBuckets()) {
InternalMax subMax = b.getAggregations().get("sub_max");
assertThat(subMax.getValue(), equalTo(Double.NEGATIVE_INFINITY))
;
}
}
}
} }
 End of changes. 3 change blocks. 
0 lines changed or deleted 34 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)