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

Mappings: Remove includes and excludes from _source

Regardless of the outcome of #8142, we should at least enforce that
when _source is enabled, it is sufficient to reindex. This change
removes the excludes and includes settings, since these modify
the source, causing us to lose the ability to reindex some fields.

closes #10814
Ryan Ernst 10 жил өмнө
parent
commit
bf09e58cb3

+ 0 - 19
docs/reference/mapping/fields/source-field.asciidoc

@@ -20,22 +20,3 @@ example:
     }
 }
 --------------------------------------------------
-
-[float]
-[[include-exclude]]
-==== Includes / Excludes
-
-Allow to specify paths in the source that would be included / excluded
-when it's stored, supporting `*` as wildcard annotation. For example:
-
-[source,js]
---------------------------------------------------
-{
-    "my_type" : {
-        "_source" : {
-            "includes" : ["path1.*", "path2.*"],
-            "excludes" : ["path3.*"]
-        }
-    }
-}
---------------------------------------------------

+ 6 - 2
docs/reference/migration/migrate_2_0.asciidoc

@@ -270,7 +270,7 @@ to provide special features.  They now have limited configuration options.
 * `_field_names` configuration is limited to disabling the field.
 * `_size` configuration is limited to enabling the field.
 
-=== Boolean fields
+==== Boolean fields
 
 Boolean fields used to have a string fielddata with `F` meaning `false` and `T`
 meaning `true`. They have been refactored to use numeric fielddata, with `0`
@@ -302,10 +302,14 @@ the user-friendly representation of boolean fields: `false`/`true`:
 ]
 ---------------
 
-=== Murmur3 Fields
+==== Murmur3 Fields
 Fields of type `murmur3` can no longer change `doc_values` or `index` setting.
 They are always stored with doc values, and not indexed.
 
+==== Source field configuration
+The `_source` field no longer supports `includes` and `excludes` paramters. When
+`_source` is enabled, the entire original source will be stored.
+
 === Codecs
 
 It is no longer possible to specify per-field postings and doc values formats

+ 3 - 2
src/main/java/org/elasticsearch/index/mapper/internal/SourceFieldMapper.java

@@ -26,6 +26,7 @@ import org.apache.lucene.document.StoredField;
 import org.apache.lucene.index.IndexOptions;
 import org.apache.lucene.util.BytesRef;
 import org.elasticsearch.ElasticsearchParseException;
+import org.elasticsearch.Version;
 import org.elasticsearch.common.Strings;
 import org.elasticsearch.common.bytes.BytesArray;
 import org.elasticsearch.common.bytes.BytesReference;
@@ -166,7 +167,7 @@ public class SourceFieldMapper extends AbstractFieldMapper<byte[]> implements In
                 } else if ("format".equals(fieldName)) {
                     builder.format(nodeStringValue(fieldNode, null));
                     iterator.remove();
-                } else if (fieldName.equals("includes")) {
+                } else if (fieldName.equals("includes") && parserContext.indexVersionCreated().before(Version.V_2_0_0)) {
                     List<Object> values = (List<Object>) fieldNode;
                     String[] includes = new String[values.size()];
                     for (int i = 0; i < includes.length; i++) {
@@ -174,7 +175,7 @@ public class SourceFieldMapper extends AbstractFieldMapper<byte[]> implements In
                     }
                     builder.includes(includes);
                     iterator.remove();
-                } else if (fieldName.equals("excludes")) {
+                } else if (fieldName.equals("excludes") && parserContext.indexVersionCreated().before(Version.V_2_0_0)) {
                     List<Object> values = (List<Object>) fieldNode;
                     String[] excludes = new String[values.size()];
                     for (int i = 0; i < excludes.length; i++) {

+ 5 - 3
src/test/java/org/elasticsearch/get/GetActionTests.java

@@ -21,11 +21,13 @@ package org.elasticsearch.get;
 
 import org.elasticsearch.ElasticsearchException;
 import org.elasticsearch.ElasticsearchIllegalArgumentException;
+import org.elasticsearch.Version;
 import org.elasticsearch.action.ShardOperationFailedException;
 import org.elasticsearch.action.admin.indices.alias.Alias;
 import org.elasticsearch.action.admin.indices.flush.FlushResponse;
 import org.elasticsearch.action.delete.DeleteResponse;
 import org.elasticsearch.action.get.*;
+import org.elasticsearch.cluster.metadata.IndexMetaData;
 import org.elasticsearch.common.Base64;
 import org.elasticsearch.common.Nullable;
 import org.elasticsearch.common.Strings;
@@ -412,7 +414,7 @@ public class GetActionTests extends ElasticsearchIntegrationTest {
 
         assertAcked(prepareCreate(index)
                 .addMapping(type, mapping)
-                .setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1)));
+                .setSettings("index.refresh_interval", -1, IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id));
 
         client().prepareIndex(index, type, "1")
                 .setSource(jsonBuilder().startObject().field("field", "1", "2").field("excluded", "should not be seen").endObject())
@@ -446,7 +448,7 @@ public class GetActionTests extends ElasticsearchIntegrationTest {
 
         assertAcked(prepareCreate(index)
                 .addMapping(type, mapping)
-                .setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1)));
+                .setSettings("index.refresh_interval", -1, IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id));
 
         client().prepareIndex(index, type, "1")
                 .setSource(jsonBuilder().startObject().field("field", "1", "2").field("included", "should be seen").endObject())
@@ -482,7 +484,7 @@ public class GetActionTests extends ElasticsearchIntegrationTest {
 
         assertAcked(prepareCreate(index)
                 .addMapping(type, mapping)
-                .setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1)));
+                .setSettings("index.refresh_interval", -1, IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id));
 
         client().prepareIndex(index, type, "1")
                 .setSource(jsonBuilder().startObject()

+ 44 - 80
src/test/java/org/elasticsearch/index/mapper/source/DefaultSourceMappingTests.java

@@ -20,10 +20,13 @@
 package org.elasticsearch.index.mapper.source;
 
 import org.apache.lucene.index.IndexableField;
+import org.elasticsearch.Version;
+import org.elasticsearch.cluster.metadata.IndexMetaData;
 import org.elasticsearch.common.bytes.BytesArray;
 import org.elasticsearch.common.compress.CompressedString;
 import org.elasticsearch.common.compress.CompressorFactory;
 import org.elasticsearch.common.settings.ImmutableSettings;
+import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.common.xcontent.XContentBuilder;
 import org.elasticsearch.common.xcontent.XContentFactory;
 import org.elasticsearch.common.xcontent.XContentType;
@@ -38,12 +41,8 @@ import java.util.Map;
 
 import static org.hamcrest.Matchers.*;
 
-/**
- *
- */
 public class DefaultSourceMappingTests extends ElasticsearchSingleNodeTest {
 
-    @Test
     public void testNoFormat() throws Exception {
         String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
                 .startObject("_source").endObject()
@@ -65,7 +64,6 @@ public class DefaultSourceMappingTests extends ElasticsearchSingleNodeTest {
         assertThat(XContentFactory.xContentType(doc.source()), equalTo(XContentType.SMILE));
     }
 
-    @Test
     public void testJsonFormat() throws Exception {
         String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
                 .startObject("_source").field("format", "json").endObject()
@@ -87,7 +85,6 @@ public class DefaultSourceMappingTests extends ElasticsearchSingleNodeTest {
         assertThat(XContentFactory.xContentType(doc.source()), equalTo(XContentType.JSON));
     }
 
-    @Test
     public void testJsonFormatCompressed() throws Exception {
         String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
                 .startObject("_source").field("format", "json").field("compress", true).endObject()
@@ -113,18 +110,25 @@ public class DefaultSourceMappingTests extends ElasticsearchSingleNodeTest {
         assertThat(XContentFactory.xContentType(uncompressed), equalTo(XContentType.JSON));
     }
 
-    @Test
-    public void testIncludeExclude() throws Exception {
+    public void testIncludesBackcompat() throws Exception {
         String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
-                .startObject("_source").field("includes", new String[]{"path1*"}).endObject()
-                .endObject().endObject().string();
+            .startObject("_source").field("includes", new String[]{"path1*"}).endObject()
+            .endObject().endObject().string();
+
+        try {
+            createIndex("testbad").mapperService().documentMapperParser().parse(mapping);
+            fail("includes should not be allowed");
+        } catch (MapperParsingException e) {
+            assertTrue(e.getMessage().contains("unsupported parameters"));
+        }
 
-        DocumentMapper documentMapper = createIndex("test").mapperService().documentMapperParser().parse(mapping);
+        Settings settings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build();
+        DocumentMapper documentMapper = createIndex("test", settings).mapperService().documentMapperParser().parse(mapping);
 
         ParsedDocument doc = documentMapper.parse("type", "1", XContentFactory.jsonBuilder().startObject()
-                .startObject("path1").field("field1", "value1").endObject()
-                .startObject("path2").field("field2", "value2").endObject()
-                .endObject().bytes());
+            .startObject("path1").field("field1", "value1").endObject()
+            .startObject("path2").field("field2", "value2").endObject()
+            .endObject().bytes());
 
         IndexableField sourceField = doc.rootDoc().getField("_source");
         Map<String, Object> sourceAsMap = XContentFactory.xContent(XContentType.JSON).createParser(new BytesArray(sourceField.binaryValue())).mapAndClose();
@@ -132,7 +136,32 @@ public class DefaultSourceMappingTests extends ElasticsearchSingleNodeTest {
         assertThat(sourceAsMap.containsKey("path2"), equalTo(false));
     }
 
-    @Test
+    public void testExcludesBackcompat() throws Exception {
+        String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
+            .startObject("_source").field("excludes", new String[]{"path1*"}).endObject()
+            .endObject().endObject().string();
+
+        try {
+            createIndex("testbad").mapperService().documentMapperParser().parse(mapping);
+            fail("excludes should not be allowed");
+        } catch (MapperParsingException e) {
+            assertTrue(e.getMessage().contains("unsupported parameters"));
+        }
+
+        Settings settings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build();
+        DocumentMapper documentMapper = createIndex("test", settings).mapperService().documentMapperParser().parse(mapping);
+
+        ParsedDocument doc = documentMapper.parse("type", "1", XContentFactory.jsonBuilder().startObject()
+            .startObject("path1").field("field1", "value1").endObject()
+            .startObject("path2").field("field2", "value2").endObject()
+            .endObject().bytes());
+
+        IndexableField sourceField = doc.rootDoc().getField("_source");
+        Map<String, Object> sourceAsMap = XContentFactory.xContent(XContentType.JSON).createParser(new BytesArray(sourceField.binaryValue())).mapAndClose();
+        assertThat(sourceAsMap.containsKey("path1"), equalTo(false));
+        assertThat(sourceAsMap.containsKey("path2"), equalTo(true));
+    }
+
     public void testDefaultMappingAndNoMapping() throws Exception {
         String defaultMapping = XContentFactory.jsonBuilder().startObject().startObject(MapperService.DEFAULT_MAPPING)
                 .startObject("_source").field("enabled", false).endObject()
@@ -161,7 +190,6 @@ public class DefaultSourceMappingTests extends ElasticsearchSingleNodeTest {
         }
     }
 
-    @Test
     public void testDefaultMappingAndWithMappingOverride() throws Exception {
         String defaultMapping = XContentFactory.jsonBuilder().startObject().startObject(MapperService.DEFAULT_MAPPING)
                 .startObject("_source").field("enabled", false).endObject()
@@ -176,7 +204,6 @@ public class DefaultSourceMappingTests extends ElasticsearchSingleNodeTest {
         assertThat(mapper.sourceMapper().enabled(), equalTo(true));
     }
 
-    @Test
     public void testDefaultMappingAndNoMappingWithMapperService() throws Exception {
         String defaultMapping = XContentFactory.jsonBuilder().startObject().startObject(MapperService.DEFAULT_MAPPING)
                 .startObject("_source").field("enabled", false).endObject()
@@ -190,7 +217,6 @@ public class DefaultSourceMappingTests extends ElasticsearchSingleNodeTest {
         assertThat(mapper.sourceMapper().enabled(), equalTo(false));
     }
 
-    @Test
     public void testDefaultMappingAndWithMappingOverrideWithMapperService() throws Exception {
         String defaultMapping = XContentFactory.jsonBuilder().startObject().startObject(MapperService.DEFAULT_MAPPING)
                 .startObject("_source").field("enabled", false).endObject()
@@ -208,66 +234,4 @@ public class DefaultSourceMappingTests extends ElasticsearchSingleNodeTest {
         assertThat(mapper.type(), equalTo("my_type"));
         assertThat(mapper.sourceMapper().enabled(), equalTo(true));
     }
-
-    @Test
-    public void testParsingWithDefaultAppliedAndNotApplied() throws Exception {
-        String defaultMapping = XContentFactory.jsonBuilder().startObject().startObject(MapperService.DEFAULT_MAPPING)
-                .startObject("_source").array("includes", "default_field_path.").endObject()
-                .endObject().endObject().string();
-
-        MapperService mapperService = createIndex("test").mapperService();
-        mapperService.merge(MapperService.DEFAULT_MAPPING, new CompressedString(defaultMapping), true);
-
-        String mapping = XContentFactory.jsonBuilder().startObject().startObject("my_type")
-                .startObject("_source").array("includes", "custom_field_path.").endObject()
-                .endObject().endObject().string();
-        mapperService.merge("my_type", new CompressedString(mapping), true);
-        DocumentMapper mapper = mapperService.documentMapper("my_type");
-        assertThat(mapper.type(), equalTo("my_type"));
-        assertThat(mapper.sourceMapper().includes().length, equalTo(2));
-        assertThat(mapper.sourceMapper().includes(), hasItemInArray("default_field_path."));
-        assertThat(mapper.sourceMapper().includes(), hasItemInArray("custom_field_path."));
-
-        mapping = XContentFactory.jsonBuilder().startObject().startObject("my_type")
-                .startObject("properties").startObject("text").field("type", "string").endObject().endObject()
-                .endObject().endObject().string();
-        mapperService.merge("my_type", new CompressedString(mapping), false);
-        mapper = mapperService.documentMapper("my_type");
-        assertThat(mapper.type(), equalTo("my_type"));
-        assertThat(mapper.sourceMapper().includes(), hasItemInArray("default_field_path."));
-        assertThat(mapper.sourceMapper().includes(), hasItemInArray("custom_field_path."));
-        assertThat(mapper.sourceMapper().includes().length, equalTo(2));
-    }
-
-    public void testDefaultNotAppliedOnUpdate() throws Exception {
-        XContentBuilder defaultMapping = XContentFactory.jsonBuilder().startObject().startObject(MapperService.DEFAULT_MAPPING)
-                .startObject("_source").array("includes", "default_field_path.").endObject()
-                .endObject().endObject();
-
-        IndexService indexService = createIndex("test", ImmutableSettings.EMPTY, MapperService.DEFAULT_MAPPING, defaultMapping);
-
-        String mapping = XContentFactory.jsonBuilder().startObject().startObject("my_type")
-                .startObject("_source").array("includes", "custom_field_path.").endObject()
-                .endObject().endObject().string();
-        client().admin().indices().preparePutMapping("test").setType("my_type").setSource(mapping).get();
-
-        DocumentMapper mapper = indexService.mapperService().documentMapper("my_type");
-        assertThat(mapper.type(), equalTo("my_type"));
-        assertThat(mapper.sourceMapper().includes().length, equalTo(2));
-        List<String> includes = Arrays.asList(mapper.sourceMapper().includes());
-        assertThat("default_field_path.", isIn(includes));
-        assertThat("custom_field_path.", isIn(includes));
-
-        mapping = XContentFactory.jsonBuilder().startObject().startObject("my_type")
-                .startObject("properties").startObject("text").field("type", "string").endObject().endObject()
-                .endObject().endObject().string();
-        client().admin().indices().preparePutMapping("test").setType("my_type").setSource(mapping).get();
-
-        mapper = indexService.mapperService().documentMapper("my_type");
-        assertThat(mapper.type(), equalTo("my_type"));
-        includes = Arrays.asList(mapper.sourceMapper().includes());
-        assertThat("default_field_path.", isIn(includes));
-        assertThat("custom_field_path.", isIn(includes));
-        assertThat(mapper.sourceMapper().includes().length, equalTo(2));
-    }
 }

+ 10 - 14
src/test/java/org/elasticsearch/indices/mapping/UpdateMappingTests.java → src/test/java/org/elasticsearch/indices/mapping/UpdateMappingIntegrationTests.java

@@ -21,6 +21,7 @@ package org.elasticsearch.indices.mapping;
 
 import com.google.common.collect.Lists;
 
+import org.elasticsearch.Version;
 import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
 import org.elasticsearch.action.admin.indices.refresh.RefreshResponse;
@@ -28,6 +29,7 @@ import org.elasticsearch.action.count.CountResponse;
 import org.elasticsearch.action.get.GetResponse;
 import org.elasticsearch.action.index.IndexRequestBuilder;
 import org.elasticsearch.client.Client;
+import org.elasticsearch.cluster.metadata.IndexMetaData;
 import org.elasticsearch.cluster.metadata.MappingMetaData;
 import org.elasticsearch.common.Priority;
 import org.elasticsearch.common.collect.ImmutableOpenMap;
@@ -54,7 +56,7 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.*;
 import static org.hamcrest.Matchers.*;
 
 @ClusterScope(randomDynamicTemplates = false)
-public class UpdateMappingTests extends ElasticsearchIntegrationTest {
+public class UpdateMappingIntegrationTests extends ElasticsearchIntegrationTest {
 
     @Test
     public void dynamicUpdates() throws Exception {
@@ -213,13 +215,13 @@ public class UpdateMappingTests extends ElasticsearchIntegrationTest {
 
     @SuppressWarnings("unchecked")
     @Test
-    public void updateIncludeExclude() throws Exception {
-        assertAcked(prepareCreate("test").addMapping("type",
-                jsonBuilder().startObject().startObject("type").startObject("properties")
-                        .startObject("normal").field("type", "long").endObject()
-                        .startObject("exclude").field("type", "long").endObject()
-                        .startObject("include").field("type", "long").endObject()
-                        .endObject().endObject().endObject()));
+    public void updateIncludeExcludeBackcompat() throws Exception {
+        assertAcked(prepareCreate("test").setSettings(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id)
+            .addMapping("type", jsonBuilder().startObject().startObject("type").startObject("properties")
+                    .startObject("normal").field("type", "long").endObject()
+                    .startObject("exclude").field("type", "long").endObject()
+                    .startObject("include").field("type", "long").endObject()
+                    .endObject().endObject().endObject()));
         ensureGreen(); // make sure that replicas are initialized so the refresh command will work them too
 
         logger.info("Index doc");
@@ -229,7 +231,6 @@ public class UpdateMappingTests extends ElasticsearchIntegrationTest {
         );
         refresh(); // commit it for later testing.
 
-
         logger.info("Adding exclude settings");
         PutMappingResponse putResponse = client().admin().indices().preparePutMapping("test").setType("type").setSource(
                 JsonXContent.contentBuilder().startObject().startObject("type")
@@ -259,7 +260,6 @@ public class UpdateMappingTests extends ElasticsearchIntegrationTest {
         assertThat(getResponse.getSource(), not(hasKey("exclude")));
         assertThat(getResponse.getSource(), hasKey("include"));
 
-
         logger.info("Changing mapping to includes");
         putResponse = client().admin().indices().preparePutMapping("test").setType("type").setSource(
                 JsonXContent.contentBuilder().startObject().startObject("type")
@@ -278,7 +278,6 @@ public class UpdateMappingTests extends ElasticsearchIntegrationTest {
         assertThat((Map<String, Object>) typeMapping.getSourceAsMap().get("_source"), hasKey("excludes"));
         assertThat((ArrayList<String>) ((Map<String, Object>) typeMapping.getSourceAsMap().get("_source")).get("excludes"), emptyIterable());
 
-
         logger.info("Indexing doc yet again");
         index("test", "type", "1", JsonXContent.contentBuilder().startObject()
                         .field("normal", 3).field("exclude", 3).field("include", 3)
@@ -290,7 +289,6 @@ public class UpdateMappingTests extends ElasticsearchIntegrationTest {
         assertThat(getResponse.getSource(), not(hasKey("exclude")));
         assertThat(getResponse.getSource(), hasKey("include"));
 
-
         logger.info("Adding excludes, but keep includes");
         putResponse = client().admin().indices().preparePutMapping("test").setType("type").setSource(
                 JsonXContent.contentBuilder().startObject().startObject("type")
@@ -308,8 +306,6 @@ public class UpdateMappingTests extends ElasticsearchIntegrationTest {
         assertThat((Map<String, Object>) typeMapping.getSourceAsMap().get("_source"), hasKey("excludes"));
         ArrayList<String> excludes = (ArrayList<String>) ((Map<String, Object>) typeMapping.getSourceAsMap().get("_source")).get("excludes");
         assertThat(excludes, contains("*.excludes"));
-
-
     }
 
     @SuppressWarnings("unchecked")

+ 0 - 41
src/test/java/org/elasticsearch/search/geo/GeoShapeIntegrationTests.java

@@ -346,47 +346,6 @@ public class GeoShapeIntegrationTests extends ElasticsearchIntegrationTest {
         assertHitCount(result, 1);
     }
 
-    @Test // Issue 2944
-    public void testThatShapeIsReturnedEvenWhenExclusionsAreSet() throws Exception {
-        String mapping = XContentFactory.jsonBuilder().startObject().startObject("type1")
-                .startObject("properties").startObject("location")
-                .field("type", "geo_shape")
-                .endObject().endObject()
-                .startObject("_source")
-                .startArray("excludes").value("nonExistingField").endArray()
-                .endObject()
-                .endObject().endObject()
-                .string();
-        assertAcked(prepareCreate("test").addMapping("type1", mapping));
-        ensureGreen();
-
-        indexRandom(true,
-                client().prepareIndex("test", "type1", "1").setSource(jsonBuilder().startObject()
-                    .field("name", "Document 1")
-                    .startObject("location")
-                    .field("type", "envelope")
-                    .startArray("coordinates").startArray().value(-45.0).value(45).endArray().startArray().value(45).value(-45).endArray().endArray()
-                    .endObject()
-                    .endObject()));
-
-        SearchResponse searchResponse = client().prepareSearch("test").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet();
-        assertThat(searchResponse.getHits().totalHits(), equalTo(1L));
-
-        Map<String, Object> indexedMap = searchResponse.getHits().getAt(0).sourceAsMap();
-        assertThat(indexedMap.get("location"), instanceOf(Map.class));
-        Map<String, Object> locationMap = (Map<String, Object>) indexedMap.get("location");
-        assertThat(locationMap.get("coordinates"), instanceOf(List.class));
-        List<List<Number>> coordinates = (List<List<Number>>) locationMap.get("coordinates");
-        assertThat(coordinates.size(), equalTo(2));
-        assertThat(coordinates.get(0).size(), equalTo(2));
-        assertThat(coordinates.get(0).get(0).doubleValue(), equalTo(-45.0));
-        assertThat(coordinates.get(0).get(1).doubleValue(), equalTo(45.0));
-        assertThat(coordinates.get(1).size(), equalTo(2));
-        assertThat(coordinates.get(1).get(0).doubleValue(), equalTo(45.0));
-        assertThat(coordinates.get(1).get(1).doubleValue(), equalTo(-45.0));
-        assertThat(locationMap.size(), equalTo(2));
-    }
-
     @LuceneTestCase.AwaitsFix(bugUrl = "https://github.com/elasticsearch/elasticsearch/issues/9904")
     @Test
     public void testShapeFilterWithRandomGeoCollection() throws Exception {

+ 4 - 2
src/test/java/org/elasticsearch/search/innerhits/InnerHitsTests.java

@@ -19,9 +19,11 @@
 
 package org.elasticsearch.search.innerhits;
 
+import org.elasticsearch.Version;
 import org.elasticsearch.action.index.IndexRequestBuilder;
 import org.elasticsearch.action.search.SearchRequest;
 import org.elasticsearch.action.search.SearchResponse;
+import org.elasticsearch.cluster.metadata.IndexMetaData;
 import org.elasticsearch.common.xcontent.XContentBuilder;
 import org.elasticsearch.index.query.BoolQueryBuilder;
 import org.elasticsearch.index.query.support.QueryInnerHitBuilder;
@@ -772,7 +774,7 @@ public class InnerHitsTests extends ElasticsearchIntegrationTest {
 
     @Test
     public void testNestedInnerHitsWithExcludeSource() throws Exception {
-        assertAcked(prepareCreate("articles")
+        assertAcked(prepareCreate("articles").setSettings(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id)
                         .addMapping("article", jsonBuilder().startObject()
                                         .startObject("_source").field("excludes", new String[]{"comments"}).endObject()
                                         .startObject("properties")
@@ -810,7 +812,7 @@ public class InnerHitsTests extends ElasticsearchIntegrationTest {
 
     @Test
     public void testNestedInnerHitsHiglightWithExcludeSource() throws Exception {
-        assertAcked(prepareCreate("articles")
+        assertAcked(prepareCreate("articles").setSettings(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id)
                         .addMapping("article", jsonBuilder().startObject()
                                         .startObject("_source").field("excludes", new String[]{"comments"}).endObject()
                                         .startObject("properties")