From 9b0639d7f0ac63b28e12f0b072cebd608aa13add Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Tue, 27 Jun 2017 13:29:34 +0200 Subject: [PATCH] Remove usage of `mapper.single_type` from xpack tests (elastic/x-pack-elasticsearch#1853) `index.mapper.single_type` will be removed in master. While there is still one usage in the security template that we are working on, this change will remove the remaining usage. Original commit: elastic/x-pack-elasticsearch@6e7f63b9e0a029cd3091faf3e36064eab6936f43 --- plugin/src/main/resources/logstash-index-template.json | 3 +-- .../integration/DocumentLevelSecurityTests.java | 9 ++++++--- .../integration/FieldLevelSecurityTests.java | 7 +++++-- .../resources/wrong-version-logstash-index-template.json | 3 +-- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/plugin/src/main/resources/logstash-index-template.json b/plugin/src/main/resources/logstash-index-template.json index 56a57dbd164..3ed13d3a994 100644 --- a/plugin/src/main/resources/logstash-index-template.json +++ b/plugin/src/main/resources/logstash-index-template.json @@ -4,8 +4,7 @@ "index": { "number_of_shards": 1, "number_of_replicas": 1, - "codec": "best_compression", - "mapping.single_type": false + "codec": "best_compression" } }, "mappings" : { diff --git a/plugin/src/test/java/org/elasticsearch/integration/DocumentLevelSecurityTests.java b/plugin/src/test/java/org/elasticsearch/integration/DocumentLevelSecurityTests.java index 9f299314ed4..1cab06d7c3d 100644 --- a/plugin/src/test/java/org/elasticsearch/integration/DocumentLevelSecurityTests.java +++ b/plugin/src/test/java/org/elasticsearch/integration/DocumentLevelSecurityTests.java @@ -7,6 +7,7 @@ package org.elasticsearch.integration; import org.apache.lucene.search.join.ScoreMode; import org.elasticsearch.ElasticsearchSecurityException; +import org.elasticsearch.Version; import org.elasticsearch.action.bulk.BulkItemResponse; import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.action.get.GetResponse; @@ -37,6 +38,7 @@ import org.elasticsearch.search.sort.SortMode; import org.elasticsearch.search.sort.SortOrder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentBuilder; +import org.elasticsearch.test.InternalSettingsPlugin; import org.elasticsearch.test.SecurityIntegTestCase; import org.elasticsearch.xpack.XPackPlugin; import org.elasticsearch.xpack.XPackSettings; @@ -71,7 +73,8 @@ public class DocumentLevelSecurityTests extends SecurityIntegTestCase { @Override protected Collection> nodePlugins() { - return Arrays.asList(XPackPlugin.class, ParentJoinPlugin.class); + return Arrays.asList(XPackPlugin.class, ParentJoinPlugin.class, + InternalSettingsPlugin.class); } @Override @@ -584,7 +587,7 @@ public class DocumentLevelSecurityTests extends SecurityIntegTestCase { public void testChildrenAggregation() throws Exception { assertAcked(client().admin().indices().prepareCreate("test") - .setSettings("mapping.single_type", false) + .setSettings("index.version.created", Version.V_5_6_0.id) .addMapping("type1", "field1", "type=text", "field2", "type=text") .addMapping("type2", "_parent", "type=type1", "field3", "type=text,fielddata=true") ); @@ -641,7 +644,7 @@ public class DocumentLevelSecurityTests extends SecurityIntegTestCase { public void testParentChild_parentField() { assertAcked(prepareCreate("test") - .setSettings("mapping.single_type", false) + .setSettings("index.version.created", Version.V_5_6_0.id) .addMapping("parent") .addMapping("child", "_parent", "type=parent", "field1", "type=text", "field2", "type=text", "field3", "type=text")); ensureGreen(); diff --git a/plugin/src/test/java/org/elasticsearch/integration/FieldLevelSecurityTests.java b/plugin/src/test/java/org/elasticsearch/integration/FieldLevelSecurityTests.java index b54a5cc286b..8336ef5c08b 100644 --- a/plugin/src/test/java/org/elasticsearch/integration/FieldLevelSecurityTests.java +++ b/plugin/src/test/java/org/elasticsearch/integration/FieldLevelSecurityTests.java @@ -7,6 +7,7 @@ package org.elasticsearch.integration; import org.apache.lucene.search.join.ScoreMode; import org.elasticsearch.ElasticsearchSecurityException; +import org.elasticsearch.Version; import org.elasticsearch.action.bulk.BulkItemResponse; import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.action.fieldstats.FieldStatsResponse; @@ -35,6 +36,7 @@ import org.elasticsearch.search.aggregations.AggregationBuilders; import org.elasticsearch.search.aggregations.bucket.terms.Terms; import org.elasticsearch.search.sort.SortOrder; import org.elasticsearch.test.ESIntegTestCase; +import org.elasticsearch.test.InternalSettingsPlugin; import org.elasticsearch.test.SecurityIntegTestCase; import org.elasticsearch.xpack.XPackPlugin; import org.elasticsearch.xpack.XPackSettings; @@ -72,7 +74,8 @@ public class FieldLevelSecurityTests extends SecurityIntegTestCase { @Override protected Collection> nodePlugins() { - return Arrays.asList(XPackPlugin.class, ParentJoinPlugin.class); + return Arrays.asList(XPackPlugin.class, ParentJoinPlugin.class, + InternalSettingsPlugin.class); } @Override @@ -1300,7 +1303,7 @@ public class FieldLevelSecurityTests extends SecurityIntegTestCase { public void testParentChild_parentField() { assertAcked(prepareCreate("test") - .setSettings("mapping.single_type", false) + .setSettings("index.version.created", Version.V_5_6_0.id) .addMapping("parent") .addMapping("child", "_parent", "type=parent")); ensureGreen(); diff --git a/plugin/src/test/resources/wrong-version-logstash-index-template.json b/plugin/src/test/resources/wrong-version-logstash-index-template.json index 6a6b616a8a5..b9603a00857 100644 --- a/plugin/src/test/resources/wrong-version-logstash-index-template.json +++ b/plugin/src/test/resources/wrong-version-logstash-index-template.json @@ -4,8 +4,7 @@ "index": { "number_of_shards": 1, "number_of_replicas": 1, - "codec": "best_compression", - "mapping.single_type": false + "codec": "best_compression" } }, "mappings" : {