Browse Source

Enforce at most one type. (#24428)

This is a follow-up to #24317, which did the hard work but was merged in such a
way that it exposes the setting while still allowing indices to have multiple
types by default in order to give time to people who test against master to
add this setting to their index settings.
Adrien Grand 8 years ago
parent
commit
d0e71510ad

+ 2 - 4
core/src/main/java/org/elasticsearch/index/mapper/MapperService.java

@@ -99,12 +99,10 @@ public class MapperService extends AbstractIndexComponent implements Closeable {
     public static final Setting<Boolean> INDEX_MAPPING_SINGLE_TYPE_SETTING;
     static {
         Function<Settings, String> defValue = settings -> {
-            // TODO: uncomment this
-            /*boolean singleType = true;
+            boolean singleType = true;
             if (settings.getAsVersion(IndexMetaData.SETTING_VERSION_CREATED, null) != null) {
                 singleType = Version.indexCreated(settings).onOrAfter(Version.V_6_0_0_alpha1_UNRELEASED);
-            }*/
-            boolean singleType = false;
+            }
             return Boolean.valueOf(singleType).toString();
         };
         INDEX_MAPPING_SINGLE_TYPE_SETTING = Setting.boolSetting("index.mapping.single_type", defValue, Property.IndexScope, Property.Final);

+ 0 - 1
core/src/test/java/org/elasticsearch/index/mapper/MapperServiceTests.java

@@ -310,7 +310,6 @@ public class MapperServiceTests extends ESSingleNodeTestCase {
             containsString("cannot have nested fields when index sort is activated"));
     }
 
-    @AwaitsFix(bugUrl="https://github.com/elastic/elasticsearch/pull/24317#issuecomment-297624290")
     public void testForbidMultipleTypes() throws IOException {
         String mapping = XContentFactory.jsonBuilder().startObject().startObject("type").endObject().endObject().string();
         MapperService mapperService = createIndex("test").mapperService();