Skip to content

Commit deafce1

Browse files
authored
[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.
1 parent cb451ed commit deafce1

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportOpenJobAction.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
import org.elasticsearch.xpack.core.ml.job.config.JobTaskState;
5050
import org.elasticsearch.xpack.core.ml.job.config.JobUpdate;
5151
import org.elasticsearch.xpack.core.ml.job.persistence.AnomalyDetectorsIndex;
52-
import org.elasticsearch.xpack.core.ml.job.persistence.ElasticsearchMappings;
5352
import org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper;
5453
import org.elasticsearch.xpack.ml.MachineLearning;
5554
import org.elasticsearch.xpack.ml.MlConfigMigrationEligibilityCheck;
@@ -459,19 +458,11 @@ public void onFailure(Exception e) {
459458
);
460459

461460
// Tell the job tracker to refresh the memory requirement for this job and all other jobs that have persistent tasks
462-
ActionListener<Boolean> jobUpdateListener = ActionListener.wrap(
461+
ActionListener<Boolean> getJobHandler = ActionListener.wrap(
463462
response -> memoryTracker.refreshJobMemoryAndAllOthers(jobParams.getJobId(), memoryRequirementRefreshListener),
464463
listener::onFailure
465464
);
466465

467-
// Try adding state doc mapping
468-
ActionListener<Void> getJobHandler = ActionListener.wrap(
469-
response -> {
470-
ElasticsearchMappings.addDocMappingIfMissing(AnomalyDetectorsIndex.jobStateIndexWriteAlias(),
471-
ElasticsearchMappings::stateMapping, client, state, jobUpdateListener);
472-
}, listener::onFailure
473-
);
474-
475466
// Get the job config
476467
jobConfigProvider.getJob(jobParams.getJobId(), ActionListener.wrap(
477468
builder -> {

0 commit comments

Comments
 (0)