[ML] Enable single_type on ML indices (elastic/x-pack-elasticsearch#1566)
Relates elastic/x-pack-elasticsearch#668 Original commit: elastic/x-pack-elasticsearch@7e11ed2774
This commit is contained in:
parent
8ec9427196
commit
8dc50990a3
|
@ -29,9 +29,6 @@ import org.elasticsearch.index.mapper.MapperService;
|
|||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.xpack.ml.job.persistence.AnomalyDetectorsIndex;
|
||||
import org.elasticsearch.xpack.ml.job.persistence.ElasticsearchMappings;
|
||||
import org.elasticsearch.xpack.ml.job.process.autodetect.state.CategorizerState;
|
||||
import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelState;
|
||||
import org.elasticsearch.xpack.ml.job.process.autodetect.state.Quantiles;
|
||||
import org.elasticsearch.xpack.ml.notifications.AuditMessage;
|
||||
import org.elasticsearch.xpack.ml.notifications.Auditor;
|
||||
|
||||
|
@ -280,9 +277,7 @@ public class MachineLearningTemplateRegistry extends AbstractComponent implemen
|
|||
// pick up default mappings and be used in queries
|
||||
.put(MapperService.INDEX_MAPPER_DYNAMIC_SETTING.getKey(), true)
|
||||
// set the default all search field
|
||||
.put(IndexSettings.DEFAULT_FIELD_SETTING.getKey(), ElasticsearchMappings.ALL_FIELD_VALUES)
|
||||
// TODO: fix the template to use a single type
|
||||
.put("index.mapping.single_type", false);
|
||||
.put(IndexSettings.DEFAULT_FIELD_SETTING.getKey(), ElasticsearchMappings.ALL_FIELD_VALUES);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -313,9 +308,7 @@ public class MachineLearningTemplateRegistry extends AbstractComponent implemen
|
|||
// Sacrifice durability for performance: in the event of power
|
||||
// failure we can lose the last 5 seconds of changes, but it's
|
||||
// much faster
|
||||
.put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), ASYNC)
|
||||
// TODO: do not create multiple types
|
||||
.put("index.mapping.single_type", false);
|
||||
.put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), ASYNC);
|
||||
}
|
||||
|
||||
public static boolean allTemplatesInstalled(MetaData metaData) {
|
||||
|
|
|
@ -149,13 +149,12 @@ public class MachineLearningTemplateRegistryTests extends ESTestCase {
|
|||
new MachineLearningTemplateRegistry(createSettings(), clusterService, client, threadPool);
|
||||
Settings settings = templateRegistry.mlResultsIndexSettings().build();
|
||||
|
||||
assertEquals(5, settings.size());
|
||||
assertEquals(4, settings.size());
|
||||
assertThat(settings.get("index.number_of_shards"), is(nullValue()));
|
||||
assertEquals("async", settings.get("index.translog.durability"));
|
||||
assertEquals("true", settings.get("index.mapper.dynamic"));
|
||||
assertEquals("all_field_values", settings.get("index.query.default_field"));
|
||||
assertEquals("2s", settings.get("index.unassigned.node_left.delayed_timeout"));
|
||||
assertEquals("false", settings.get("index.mapping.single_type"));
|
||||
}
|
||||
|
||||
public void testMlAuditIndexSettings() {
|
||||
|
@ -174,11 +173,9 @@ public class MachineLearningTemplateRegistryTests extends ESTestCase {
|
|||
new MachineLearningTemplateRegistry(createSettings(), clusterService, client, threadPool);
|
||||
Settings settings = templateRegistry.mlStateIndexSettings().build();
|
||||
|
||||
assertEquals(3, settings.size());
|
||||
assertThat(settings.get("index.number_of_shards"), is(nullValue()));
|
||||
assertEquals(2, settings.size());
|
||||
assertEquals("async", settings.get("index.translog.durability"));
|
||||
assertEquals("2s", settings.get("index.unassigned.node_left.delayed_timeout"));
|
||||
assertEquals("false", settings.get("index.mapping.single_type"));
|
||||
}
|
||||
|
||||
public void testPutNotificationIndexTemplate() {
|
||||
|
|
Loading…
Reference in New Issue