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
This commit is contained in:
parent
f0e7d88699
commit
057bf3f7d5
|
@ -227,6 +227,7 @@ public class MlConfigMigratorIT extends MlSingleNodeTestCase {
|
||||||
IndexRequest indexRequest = new IndexRequest(AnomalyDetectorsIndex.jobStateIndexWriteAlias()).id("ml-config")
|
IndexRequest indexRequest = new IndexRequest(AnomalyDetectorsIndex.jobStateIndexWriteAlias()).id("ml-config")
|
||||||
.source(Collections.singletonMap("a_field", "a_value"))
|
.source(Collections.singletonMap("a_field", "a_value"))
|
||||||
.opType(DocWriteRequest.OpType.CREATE)
|
.opType(DocWriteRequest.OpType.CREATE)
|
||||||
|
.setRequireAlias(true)
|
||||||
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
|
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
|
||||||
|
|
||||||
client().index(indexRequest).actionGet();
|
client().index(indexRequest).actionGet();
|
||||||
|
|
|
@ -288,6 +288,7 @@ public class ResultsPersisterService {
|
||||||
private BulkRequest buildNewRequestFromFailures(BulkRequest bulkRequest, BulkResponse bulkResponse) {
|
private BulkRequest buildNewRequestFromFailures(BulkRequest bulkRequest, BulkResponse bulkResponse) {
|
||||||
// If we failed, lets set the bulkRequest to be a collection of the failed requests
|
// If we failed, lets set the bulkRequest to be a collection of the failed requests
|
||||||
BulkRequest bulkRequestOfFailures = new BulkRequest();
|
BulkRequest bulkRequestOfFailures = new BulkRequest();
|
||||||
|
bulkRequestOfFailures.requireAlias(bulkRequest.requireAlias());
|
||||||
Set<String> failedDocIds = Arrays.stream(bulkResponse.getItems())
|
Set<String> failedDocIds = Arrays.stream(bulkResponse.getItems())
|
||||||
.filter(BulkItemResponse::isFailed)
|
.filter(BulkItemResponse::isFailed)
|
||||||
.map(BulkItemResponse::getId)
|
.map(BulkItemResponse::getId)
|
||||||
|
|
Loading…
Reference in New Issue