[ML] Fix order that DBQ is constructed
Also use Job.ID constant instead of string literal. Kudos to @dimitris-athanasiou for this one :) Original commit: elastic/x-pack-elasticsearch@906b080110
This commit is contained in:
parent
6d79210f79
commit
e441e0dc4e
|
@ -21,6 +21,7 @@ import org.elasticsearch.action.bulk.byscroll.DeleteByQueryRequest;
|
|||
import org.elasticsearch.action.bulk.byscroll.BulkByScrollResponse;
|
||||
import org.elasticsearch.tasks.TaskId;
|
||||
import org.elasticsearch.xpack.ml.action.MlDeleteByQueryAction;
|
||||
import org.elasticsearch.xpack.ml.job.config.Job;
|
||||
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
@ -69,8 +70,8 @@ public class JobStorageDeletionTask extends Task {
|
|||
// Step 1. DeleteByQuery on the index, matching all docs with the right job_id
|
||||
// -------
|
||||
SearchRequest searchRequest = new SearchRequest(indexPattern);
|
||||
searchRequest.source(new SearchSourceBuilder().query(new TermQueryBuilder("job_id", jobId)));
|
||||
DeleteByQueryRequest request = new DeleteByQueryRequest(searchRequest);
|
||||
searchRequest.source(new SearchSourceBuilder().query(new TermQueryBuilder(Job.ID.getPreferredName(), jobId)));
|
||||
request.setSlices(5);
|
||||
|
||||
client.execute(MlDeleteByQueryAction.INSTANCE, request,
|
||||
|
|
Loading…
Reference in New Issue