ML: Fix build after HLRC change

I recently merged a HLRC change that passed the PR builds but didn't
compile after merging. Sad time. This fixes the compilation.
This commit is contained in:
Nik Everett 2018-09-04 11:10:44 -04:00
parent dbc7102c86
commit ebd5eb6dc2
1 changed files with 3 additions and 6 deletions

View File

@ -196,15 +196,12 @@ public class TransportDeleteForecastAction extends HandledTransportAction<Delete
} }
private DeleteByQueryRequest buildDeleteByQuery(String jobId, List<String> forecastsToDelete) { private DeleteByQueryRequest buildDeleteByQuery(String jobId, List<String> forecastsToDelete) {
SearchRequest searchRequest = new SearchRequest(); DeleteByQueryRequest request = new DeleteByQueryRequest()
// We need to create the DeleteByQueryRequest before we modify the SearchRequest
// because the constructor of the former wipes the latter
DeleteByQueryRequest request = new DeleteByQueryRequest(searchRequest)
.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
.setSize(MAX_FORECAST_TO_SEARCH) .setSize(MAX_FORECAST_TO_SEARCH)
.setSlices(5); .setSlices(5);
searchRequest.indices(AnomalyDetectorsIndex.jobResultsAliasedName(jobId)); request.indices(AnomalyDetectorsIndex.jobResultsAliasedName(jobId));
BoolQueryBuilder innerBoolQuery = QueryBuilders.boolQuery(); BoolQueryBuilder innerBoolQuery = QueryBuilders.boolQuery();
innerBoolQuery innerBoolQuery
.must(QueryBuilders.termsQuery(Result.RESULT_TYPE.getPreferredName(), .must(QueryBuilders.termsQuery(Result.RESULT_TYPE.getPreferredName(),
@ -213,7 +210,7 @@ public class TransportDeleteForecastAction extends HandledTransportAction<Delete
forecastsToDelete)); forecastsToDelete));
QueryBuilder query = QueryBuilders.boolQuery().filter(innerBoolQuery); QueryBuilder query = QueryBuilders.boolQuery().filter(innerBoolQuery);
searchRequest.source(new SearchSourceBuilder().query(query)); request.setQuery(query);
return request; return request;
} }
} }