Browse Source

Fix EquivalenceIT#testRandomRanges failed with -Dtest.seed A4648847991E5C27

Set double value to double type mapping in EquivalenceIT.

Closes #19697
chengpohi 9 years ago
parent
commit
8aa1eb6aa4

+ 38 - 3
core/src/test/java/org/elasticsearch/search/aggregations/EquivalenceIT.java

@@ -103,7 +103,18 @@ public class EquivalenceIT extends ESIntegTestCase {
             }
             }
         }
         }
 
 
-        createIndex("idx");
+        prepareCreate("idx")
+                .addMapping("type", jsonBuilder()
+                        .startObject()
+                            .startObject("type")
+                                .startObject("properties")
+                                    .startObject("values")
+                                        .field("type", "double")
+                                    .endObject()
+                                .endObject()
+                            .endObject()
+                        .endObject()).execute().actionGet();
+
         for (int i = 0; i < docs.length; ++i) {
         for (int i = 0; i < docs.length; ++i) {
             XContentBuilder source = jsonBuilder()
             XContentBuilder source = jsonBuilder()
                     .startObject()
                     .startObject()
@@ -202,6 +213,9 @@ public class EquivalenceIT extends ESIntegTestCase {
                         .startObject()
                         .startObject()
                             .startObject("type")
                             .startObject("type")
                                 .startObject("properties")
                                 .startObject("properties")
+                                    .startObject("num")
+                                        .field("type", "double")
+                                        .endObject()
                                     .startObject("string_values")
                                     .startObject("string_values")
                                         .field("type", "keyword")
                                         .field("type", "keyword")
                                         .startObject("fields")
                                         .startObject("fields")
@@ -323,7 +337,18 @@ public class EquivalenceIT extends ESIntegTestCase {
 
 
     // Duel between histograms and scripted terms
     // Duel between histograms and scripted terms
     public void testDuelTermsHistogram() throws Exception {
     public void testDuelTermsHistogram() throws Exception {
-        createIndex("idx");
+        prepareCreate("idx")
+                .addMapping("type", jsonBuilder()
+                        .startObject()
+                            .startObject("type")
+                                .startObject("properties")
+                                    .startObject("num")
+                                        .field("type", "double")
+                                    .endObject()
+                                .endObject()
+                            .endObject()
+                        .endObject()).execute().actionGet();
+
 
 
         final int numDocs = scaledRandomIntBetween(500, 5000);
         final int numDocs = scaledRandomIntBetween(500, 5000);
         final int maxNumTerms = randomIntBetween(10, 2000);
         final int maxNumTerms = randomIntBetween(10, 2000);
@@ -383,7 +408,17 @@ public class EquivalenceIT extends ESIntegTestCase {
 
 
     public void testLargeNumbersOfPercentileBuckets() throws Exception {
     public void testLargeNumbersOfPercentileBuckets() throws Exception {
         // test high numbers of percentile buckets to make sure paging and release work correctly
         // test high numbers of percentile buckets to make sure paging and release work correctly
-        createIndex("idx");
+        prepareCreate("idx")
+                .addMapping("type", jsonBuilder()
+                        .startObject()
+                            .startObject("type")
+                                .startObject("properties")
+                                    .startObject("double_value")
+                                        .field("type", "double")
+                                    .endObject()
+                                .endObject()
+                            .endObject()
+                        .endObject()).execute().actionGet();
 
 
         final int numDocs = scaledRandomIntBetween(2500, 5000);
         final int numDocs = scaledRandomIntBetween(2500, 5000);
         logger.info("Indexing [{}] docs", numDocs);
         logger.info("Indexing [{}] docs", numDocs);