Skip to content

Commit f2ac4ad

Browse files
authored
[ML] setting require_alias to previous value on bulk index retry (#62103)
Previous work has been done to prevent automatically creating a concrete index when an alias is desired. This commit addresses a path where this check was not being done. relates: #62064
1 parent d5f9e4e commit f2ac4ad

File tree

3 files changed

+2
-1
lines changed

3 files changed

+2
-1
lines changed

x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/ClassificationIT.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,6 @@ public void testDependentVariableIsAliasToNested() throws Exception {
618618
assertEvaluation(ALIAS_TO_NESTED_FIELD, KEYWORD_FIELD_VALUES, "ml." + predictedClassField);
619619
}
620620

621-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/62064")
622621
public void testTwoJobsWithSameRandomizeSeedUseSameTrainingSet() throws Exception {
623622
String sourceIndex = "classification_two_jobs_with_same_randomize_seed_source";
624623
String dependentVariable = KEYWORD_FIELD;

x-pack/plugin/ml/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/MlConfigMigratorIT.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ public void testExistingSnapshotDoesNotBlockMigration() throws InterruptedExcept
228228
IndexRequest indexRequest = new IndexRequest(AnomalyDetectorsIndex.jobStateIndexWriteAlias()).id("ml-config")
229229
.source(Collections.singletonMap("a_field", "a_value"))
230230
.opType(DocWriteRequest.OpType.CREATE)
231+
.setRequireAlias(true)
231232
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
232233

233234
client().index(indexRequest).actionGet();

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/utils/persistence/ResultsPersisterService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ void nextIteration(String actionName, String failureMessage) {
288288
private BulkRequest buildNewRequestFromFailures(BulkRequest bulkRequest, BulkResponse bulkResponse) {
289289
// If we failed, lets set the bulkRequest to be a collection of the failed requests
290290
BulkRequest bulkRequestOfFailures = new BulkRequest();
291+
bulkRequestOfFailures.requireAlias(bulkRequest.requireAlias());
291292
Set<String> failedDocIds = Arrays.stream(bulkResponse.getItems())
292293
.filter(BulkItemResponse::isFailed)
293294
.map(BulkItemResponse::getId)

0 commit comments

Comments
 (0)