From deafce1acda47f5d59de8ec2ec55b43ba986586f Mon Sep 17 00:00:00 2001 From: David Roberts Date: Fri, 25 Jan 2019 13:15:35 +0000 Subject: [PATCH] [ML] No need to add state doc mapping on job open in 7.x (#37759) When upgrading from 5.4 to 5.5 to 6.7 (inclusive) it was necessary to ensure there was a mapping for type "doc" on the ML state index before opening a job. This was because 5.4 created a multi-type ML state index. In version 7.x we can be sure that any such 5.4 index is no longer in use. It would have had to be reindexed into the 6.x index format prior to the upgrade to version 7.x. --- .../xpack/ml/action/TransportOpenJobAction.java | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportOpenJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportOpenJobAction.java index a5aed9b5b59..820da6a6213 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportOpenJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportOpenJobAction.java @@ -49,7 +49,6 @@ import org.elasticsearch.xpack.core.ml.job.config.JobState; import org.elasticsearch.xpack.core.ml.job.config.JobTaskState; import org.elasticsearch.xpack.core.ml.job.config.JobUpdate; import org.elasticsearch.xpack.core.ml.job.persistence.AnomalyDetectorsIndex; -import org.elasticsearch.xpack.core.ml.job.persistence.ElasticsearchMappings; import org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper; import org.elasticsearch.xpack.ml.MachineLearning; import org.elasticsearch.xpack.ml.MlConfigMigrationEligibilityCheck; @@ -459,19 +458,11 @@ public class TransportOpenJobAction extends TransportMasterNodeAction jobUpdateListener = ActionListener.wrap( + ActionListener getJobHandler = ActionListener.wrap( response -> memoryTracker.refreshJobMemoryAndAllOthers(jobParams.getJobId(), memoryRequirementRefreshListener), listener::onFailure ); - // Try adding state doc mapping - ActionListener getJobHandler = ActionListener.wrap( - response -> { - ElasticsearchMappings.addDocMappingIfMissing(AnomalyDetectorsIndex.jobStateIndexWriteAlias(), - ElasticsearchMappings::stateMapping, client, state, jobUpdateListener); - }, listener::onFailure - ); - // Get the job config jobConfigProvider.getJob(jobParams.getJobId(), ActionListener.wrap( builder -> {