diff --git a/docs/reference/mapping/fields/source-field.asciidoc b/docs/reference/mapping/fields/source-field.asciidoc index f09c192f57ad1..8f57613dbe142 100644 --- a/docs/reference/mapping/fields/source-field.asciidoc +++ b/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.*"] - } - } -} --------------------------------------------------- diff --git a/docs/reference/migration/migrate_2_0.asciidoc b/docs/reference/migration/migrate_2_0.asciidoc index f4dc3e506ec51..40290e4cb1fc9 100644 --- a/docs/reference/migration/migrate_2_0.asciidoc +++ b/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 diff --git a/src/main/java/org/elasticsearch/index/mapper/internal/SourceFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/internal/SourceFieldMapper.java index 2ee13f20982ef..e1315d3e0c4f3 100644 --- a/src/main/java/org/elasticsearch/index/mapper/internal/SourceFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/internal/SourceFieldMapper.java @@ -26,6 +26,7 @@ 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 Mapper.Builder parse(String name, Map node, ParserContext } 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 values = (List) fieldNode; String[] includes = new String[values.size()]; for (int i = 0; i < includes.length; i++) { @@ -174,7 +175,7 @@ public Mapper.Builder parse(String name, Map node, ParserContext } builder.includes(includes); iterator.remove(); - } else if (fieldName.equals("excludes")) { + } else if (fieldName.equals("excludes") && parserContext.indexVersionCreated().before(Version.V_2_0_0)) { List values = (List) fieldNode; String[] excludes = new String[values.size()]; for (int i = 0; i < excludes.length; i++) { diff --git a/src/test/java/org/elasticsearch/get/GetActionTests.java b/src/test/java/org/elasticsearch/get/GetActionTests.java index 071cccd4f46fb..822ab88194ce1 100644 --- a/src/test/java/org/elasticsearch/get/GetActionTests.java +++ b/src/test/java/org/elasticsearch/get/GetActionTests.java @@ -21,11 +21,13 @@ 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 void testThatGetFromTranslogShouldWorkWithExclude() throws Exception { 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 void testThatGetFromTranslogShouldWorkWithInclude() throws Exception { 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 void testThatGetFromTranslogShouldWorkWithIncludeExcludeAndFields() throw 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() diff --git a/src/test/java/org/elasticsearch/index/mapper/source/DefaultSourceMappingTests.java b/src/test/java/org/elasticsearch/index/mapper/source/DefaultSourceMappingTests.java index b8b0a91af3807..fb50de2205d5a 100644 --- a/src/test/java/org/elasticsearch/index/mapper/source/DefaultSourceMappingTests.java +++ b/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 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 void testNoFormat() throws Exception { 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 void testJsonFormat() throws Exception { 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 void testJsonFormatCompressed() throws Exception { 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 sourceAsMap = XContentFactory.xContent(XContentType.JSON).createParser(new BytesArray(sourceField.binaryValue())).mapAndClose(); @@ -132,7 +136,32 @@ public void testIncludeExclude() throws Exception { 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 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 void testDefaultMappingAndNoMapping() throws Exception { } } - @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 void testDefaultMappingAndWithMappingOverride() throws Exception { 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 void testDefaultMappingAndNoMappingWithMapperService() throws Exception { 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 void testDefaultMappingAndWithMappingOverrideWithMapperService() throws E 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 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)); - } } diff --git a/src/test/java/org/elasticsearch/indices/mapping/UpdateMappingTests.java b/src/test/java/org/elasticsearch/indices/mapping/UpdateMappingIntegrationTests.java similarity index 96% rename from src/test/java/org/elasticsearch/indices/mapping/UpdateMappingTests.java rename to src/test/java/org/elasticsearch/indices/mapping/UpdateMappingIntegrationTests.java index 2a82d92efa0f0..11638c74660e2 100644 --- a/src/test/java/org/elasticsearch/indices/mapping/UpdateMappingTests.java +++ b/src/test/java/org/elasticsearch/indices/mapping/UpdateMappingIntegrationTests.java @@ -21,6 +21,7 @@ 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.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.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 void updateMappingNoChanges() throws Exception { @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 void updateIncludeExclude() throws Exception { ); 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 void updateIncludeExclude() throws Exception { 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 void updateIncludeExclude() throws Exception { assertThat((Map) typeMapping.getSourceAsMap().get("_source"), hasKey("excludes")); assertThat((ArrayList) ((Map) 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 void updateIncludeExclude() throws Exception { 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 void updateIncludeExclude() throws Exception { assertThat((Map) typeMapping.getSourceAsMap().get("_source"), hasKey("excludes")); ArrayList excludes = (ArrayList) ((Map) typeMapping.getSourceAsMap().get("_source")).get("excludes"); assertThat(excludes, contains("*.excludes")); - - } @SuppressWarnings("unchecked") diff --git a/src/test/java/org/elasticsearch/search/geo/GeoShapeIntegrationTests.java b/src/test/java/org/elasticsearch/search/geo/GeoShapeIntegrationTests.java index d663b95e92b65..4cec4c431f64c 100644 --- a/src/test/java/org/elasticsearch/search/geo/GeoShapeIntegrationTests.java +++ b/src/test/java/org/elasticsearch/search/geo/GeoShapeIntegrationTests.java @@ -346,47 +346,6 @@ public void testShapeFetchingPath() throws Exception { 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 indexedMap = searchResponse.getHits().getAt(0).sourceAsMap(); - assertThat(indexedMap.get("location"), instanceOf(Map.class)); - Map locationMap = (Map) indexedMap.get("location"); - assertThat(locationMap.get("coordinates"), instanceOf(List.class)); - List> coordinates = (List>) 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 { diff --git a/src/test/java/org/elasticsearch/search/innerhits/InnerHitsTests.java b/src/test/java/org/elasticsearch/search/innerhits/InnerHitsTests.java index 8a15549f0af46..428d76880b364 100644 --- a/src/test/java/org/elasticsearch/search/innerhits/InnerHitsTests.java +++ b/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 void testNestedInnerHitsWithHighlightOnStoredField() throws Exception { @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 void testNestedInnerHitsWithExcludeSource() throws Exception { @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")