[ML] Changes slice specification to auto. See #42996 (#43039) (#43070)

This commit is contained in:
Benjamin Trent 2019-06-10 21:52:22 -05:00 committed by GitHub
parent 53eb630700
commit eadfe05587
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 6 deletions

View File

@ -14,6 +14,7 @@ import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.reindex.AbstractBulkByScrollRequest;
import org.elasticsearch.index.reindex.DeleteByQueryAction; import org.elasticsearch.index.reindex.DeleteByQueryAction;
import org.elasticsearch.index.reindex.DeleteByQueryRequest; import org.elasticsearch.index.reindex.DeleteByQueryRequest;
import org.elasticsearch.tasks.Task; import org.elasticsearch.tasks.Task;
@ -77,7 +78,7 @@ public class TransportDeleteCalendarAction extends HandledTransportAction<Delete
private DeleteByQueryRequest buildDeleteByQuery(String calendarId) { private DeleteByQueryRequest buildDeleteByQuery(String calendarId) {
DeleteByQueryRequest request = new DeleteByQueryRequest(MlMetaIndex.INDEX_NAME); DeleteByQueryRequest request = new DeleteByQueryRequest(MlMetaIndex.INDEX_NAME);
request.setSlices(5); request.setSlices(AbstractBulkByScrollRequest.AUTO_SLICES);
request.setRefresh(true); request.setRefresh(true);
QueryBuilder query = QueryBuilders.termsQuery(Calendar.ID.getPreferredName(), calendarId); QueryBuilder query = QueryBuilders.termsQuery(Calendar.ID.getPreferredName(), calendarId);

View File

@ -29,6 +29,7 @@ import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.reindex.AbstractBulkByScrollRequest;
import org.elasticsearch.index.reindex.BulkByScrollResponse; import org.elasticsearch.index.reindex.BulkByScrollResponse;
import org.elasticsearch.index.reindex.DeleteByQueryAction; import org.elasticsearch.index.reindex.DeleteByQueryAction;
import org.elasticsearch.index.reindex.DeleteByQueryRequest; import org.elasticsearch.index.reindex.DeleteByQueryRequest;
@ -198,7 +199,7 @@ public class TransportDeleteForecastAction extends HandledTransportAction<Delete
DeleteByQueryRequest request = new DeleteByQueryRequest() DeleteByQueryRequest request = new DeleteByQueryRequest()
.setAbortOnVersionConflict(false) //since these documents are not updated, a conflict just means it was deleted previously .setAbortOnVersionConflict(false) //since these documents are not updated, a conflict just means it was deleted previously
.setMaxDocs(MAX_FORECAST_TO_SEARCH) .setMaxDocs(MAX_FORECAST_TO_SEARCH)
.setSlices(5); .setSlices(AbstractBulkByScrollRequest.AUTO_SLICES);
request.indices(AnomalyDetectorsIndex.jobResultsAliasedName(jobId)); request.indices(AnomalyDetectorsIndex.jobResultsAliasedName(jobId));
BoolQueryBuilder innerBoolQuery = QueryBuilders.boolQuery(); BoolQueryBuilder innerBoolQuery = QueryBuilders.boolQuery();

View File

@ -38,6 +38,7 @@ import org.elasticsearch.index.query.ConstantScoreQueryBuilder;
import org.elasticsearch.index.query.IdsQueryBuilder; import org.elasticsearch.index.query.IdsQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.query.TermQueryBuilder; import org.elasticsearch.index.query.TermQueryBuilder;
import org.elasticsearch.index.reindex.AbstractBulkByScrollRequest;
import org.elasticsearch.index.reindex.BulkByScrollResponse; import org.elasticsearch.index.reindex.BulkByScrollResponse;
import org.elasticsearch.index.reindex.DeleteByQueryAction; import org.elasticsearch.index.reindex.DeleteByQueryAction;
import org.elasticsearch.index.reindex.DeleteByQueryRequest; import org.elasticsearch.index.reindex.DeleteByQueryRequest;
@ -305,7 +306,7 @@ public class TransportDeleteJobAction extends TransportMasterNodeAction<DeleteJo
new ConstantScoreQueryBuilder(new TermQueryBuilder(Job.ID.getPreferredName(), jobId)); new ConstantScoreQueryBuilder(new TermQueryBuilder(Job.ID.getPreferredName(), jobId));
request.setQuery(query); request.setQuery(query);
request.setIndicesOptions(MlIndicesUtils.addIgnoreUnavailable(IndicesOptions.lenientExpandOpen())); request.setIndicesOptions(MlIndicesUtils.addIgnoreUnavailable(IndicesOptions.lenientExpandOpen()));
request.setSlices(5); request.setSlices(AbstractBulkByScrollRequest.AUTO_SLICES);
request.setAbortOnVersionConflict(false); request.setAbortOnVersionConflict(false);
request.setRefresh(true); request.setRefresh(true);

View File

@ -16,6 +16,7 @@ import org.elasticsearch.index.query.ConstantScoreQueryBuilder;
import org.elasticsearch.index.query.IdsQueryBuilder; import org.elasticsearch.index.query.IdsQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.reindex.AbstractBulkByScrollRequest;
import org.elasticsearch.index.reindex.BulkByScrollResponse; import org.elasticsearch.index.reindex.BulkByScrollResponse;
import org.elasticsearch.index.reindex.BulkByScrollTask; import org.elasticsearch.index.reindex.BulkByScrollTask;
import org.elasticsearch.index.reindex.DeleteByQueryAction; import org.elasticsearch.index.reindex.DeleteByQueryAction;
@ -129,7 +130,7 @@ public class JobDataDeleter {
private DeleteByQueryHolder(String index) { private DeleteByQueryHolder(String index) {
dbqRequest = new DeleteByQueryRequest(); dbqRequest = new DeleteByQueryRequest();
dbqRequest.indices(index); dbqRequest.indices(index);
dbqRequest.setSlices(5); dbqRequest.setSlices(AbstractBulkByScrollRequest.AUTO_SLICES);
dbqRequest.setAbortOnVersionConflict(false); dbqRequest.setAbortOnVersionConflict(false);
} }
} }

View File

@ -22,6 +22,7 @@ import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.reindex.AbstractBulkByScrollRequest;
import org.elasticsearch.index.reindex.BulkByScrollResponse; import org.elasticsearch.index.reindex.BulkByScrollResponse;
import org.elasticsearch.index.reindex.DeleteByQueryAction; import org.elasticsearch.index.reindex.DeleteByQueryAction;
import org.elasticsearch.index.reindex.DeleteByQueryRequest; import org.elasticsearch.index.reindex.DeleteByQueryRequest;
@ -143,7 +144,7 @@ public class ExpiredForecastsRemover implements MlDataRemover {
private DeleteByQueryRequest buildDeleteByQuery(List<ForecastRequestStats> forecastsToDelete) { private DeleteByQueryRequest buildDeleteByQuery(List<ForecastRequestStats> forecastsToDelete) {
DeleteByQueryRequest request = new DeleteByQueryRequest(); DeleteByQueryRequest request = new DeleteByQueryRequest();
request.setSlices(5); request.setSlices(AbstractBulkByScrollRequest.AUTO_SLICES);
request.indices(RESULTS_INDEX_PATTERN); request.indices(RESULTS_INDEX_PATTERN);
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery().minimumShouldMatch(1); BoolQueryBuilder boolQuery = QueryBuilders.boolQuery().minimumShouldMatch(1);

View File

@ -12,6 +12,7 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.client.Client; import org.elasticsearch.client.Client;
import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.reindex.AbstractBulkByScrollRequest;
import org.elasticsearch.index.reindex.BulkByScrollResponse; import org.elasticsearch.index.reindex.BulkByScrollResponse;
import org.elasticsearch.index.reindex.DeleteByQueryAction; import org.elasticsearch.index.reindex.DeleteByQueryAction;
import org.elasticsearch.index.reindex.DeleteByQueryRequest; import org.elasticsearch.index.reindex.DeleteByQueryRequest;
@ -85,7 +86,7 @@ public class ExpiredResultsRemover extends AbstractExpiredJobDataRemover {
private DeleteByQueryRequest createDBQRequest(Job job, long cutoffEpochMs) { private DeleteByQueryRequest createDBQRequest(Job job, long cutoffEpochMs) {
DeleteByQueryRequest request = new DeleteByQueryRequest(); DeleteByQueryRequest request = new DeleteByQueryRequest();
request.setSlices(5); request.setSlices(AbstractBulkByScrollRequest.AUTO_SLICES);
request.indices(AnomalyDetectorsIndex.jobResultsAliasedName(job.getId())); request.indices(AnomalyDetectorsIndex.jobResultsAliasedName(job.getId()));
QueryBuilder excludeFilter = QueryBuilders.termsQuery(Result.RESULT_TYPE.getPreferredName(), QueryBuilder excludeFilter = QueryBuilders.termsQuery(Result.RESULT_TYPE.getPreferredName(),