1
0
Эх сурвалжийг харах

Tests: Fix bug in SimpleSortTests.

This tests adds a mappings with {"fielddata": {"format": "doc_values"}} but the
default mapping has {"doc_values": false} so when the document mapper parsing
logic merges both we have {"doc_values": false,"fielddata": {"format": "doc_values"}}
and {"doc_values": false} wins, so the test is not using doc values while it
thought it would.
Adrien Grand 10 жил өмнө
parent
commit
717dbb0599

+ 4 - 3
src/test/java/org/elasticsearch/search/sort/SimpleSortTests.java

@@ -1560,10 +1560,11 @@ public class SimpleSortTests extends ElasticsearchIntegrationTest {
     public void testSortMetaField() throws Exception {
         final boolean idDocValues = maybeDocValues();
         final boolean timestampDocValues = maybeDocValues();
+        XContentBuilder mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
+                .startObject("_timestamp").field("enabled", true).field("store", true).field("index", !timestampDocValues || randomBoolean() ? "not_analyzed" : "no").field("doc_values", timestampDocValues).endObject()
+                .endObject().endObject();
         assertAcked(prepareCreate("test")
-            .addMapping("type", XContentFactory.jsonBuilder().startObject().startObject("type")
-                        .startObject("_timestamp").field("enabled", true).field("store", true).field("index", !timestampDocValues || randomBoolean() ? "not_analyzed" : "no").startObject("fielddata").field("format", timestampDocValues ? "doc_values" : null).endObject().endObject()
-                        .endObject().endObject()));
+            .addMapping("type", mapping));
         ensureGreen();
         final int numDocs = randomIntBetween(10, 20);
         IndexRequestBuilder[] indexReqs = new IndexRequestBuilder[numDocs];