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.
This commit is contained in:
Adrien Grand 2015-04-08 09:29:10 +02:00
parent 80e86e5719
commit 717dbb0599
1 changed files with 4 additions and 3 deletions

View File

@ -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];