|
@@ -33,14 +33,15 @@ import java.time.ZonedDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.Objects;
|
|
|
|
|
|
-import static org.elasticsearch.xpack.core.ClientHelper.ML_ORIGIN;
|
|
|
-import static org.elasticsearch.xpack.core.ClientHelper.executeAsyncWithOrigin;
|
|
|
-
|
|
|
/**
|
|
|
* Removes all results that have expired the configured retention time
|
|
|
* of their respective job. A result is deleted if its timestamp is earlier
|
|
|
* than the start of the current day (local time-zone) minus the retention
|
|
|
* period.
|
|
|
+ *
|
|
|
+ * This is expected to be used by actions requiring admin rights. Thus,
|
|
|
+ * it is also expected that the provided client will be a client with the
|
|
|
+ * ML origin so that permissions to manage ML indices are met.
|
|
|
*/
|
|
|
public class ExpiredResultsRemover extends AbstractExpiredJobDataRemover {
|
|
|
|
|
@@ -65,7 +66,7 @@ public class ExpiredResultsRemover extends AbstractExpiredJobDataRemover {
|
|
|
LOGGER.debug("Removing results of job [{}] that have a timestamp before [{}]", job.getId(), cutoffEpochMs);
|
|
|
DeleteByQueryRequest request = createDBQRequest(job, cutoffEpochMs);
|
|
|
|
|
|
- executeAsyncWithOrigin(client, ML_ORIGIN, DeleteByQueryAction.INSTANCE, request, new ActionListener<BulkByScrollResponse>() {
|
|
|
+ client.execute(DeleteByQueryAction.INSTANCE, request, new ActionListener<BulkByScrollResponse>() {
|
|
|
@Override
|
|
|
public void onResponse(BulkByScrollResponse bulkByScrollResponse) {
|
|
|
try {
|