Map value field to double in MovavgIT (#40230)

We were accidentally not mapping the index, which meant dynamic mapping
was choosing floats for the values.  This led to enough loss of precision
for the aggregated values to differ slightly from the test doubles,
which accumulated into large differences in the holt output.

This test fix adds an explicit mapping.
This commit is contained in:
Zachary Tong 2019-03-21 14:03:14 -04:00 committed by GitHub
parent 23d5f7babf
commit 78f737dad3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,6 +26,7 @@ import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.support.WriteRequest;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.collect.EvictingQueue;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
import org.elasticsearch.search.aggregations.bucket.histogram.Histogram.Bucket;
import org.elasticsearch.search.aggregations.metrics.Avg;
@ -110,7 +111,12 @@ public class MovAvgIT extends ESIntegTestCase {
@Override
public void setupSuiteScopeCluster() throws Exception {
createIndex("idx");
prepareCreate("idx").addMapping("type",
XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("properties")
.startObject(VALUE_FIELD).field("type", "double").endObject()
.endObject()
.endObject().endObject()).execute().get();
createIndex("idx_unmapped");
List<IndexRequestBuilder> builders = new ArrayList<>();