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) {
SearchRequest searchRequest = new SearchRequest();
// 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)
DeleteByQueryRequest request = new DeleteByQueryRequest()
.setAbortOnVersionConflict(false) //since these documents are not updated, a conflict just means it was deleted previously
.setSize(MAX_FORECAST_TO_SEARCH)
.setSlices(5);
searchRequest.indices(AnomalyDetectorsIndex.jobResultsAliasedName(jobId));
request.indices(AnomalyDetectorsIndex.jobResultsAliasedName(jobId));
BoolQueryBuilder innerBoolQuery = QueryBuilders.boolQuery();
innerBoolQuery
.must(QueryBuilders.termsQuery(Result.RESULT_TYPE.getPreferredName(),
@ -213,7 +210,7 @@ public class TransportDeleteForecastAction extends HandledTransportAction<Delete
forecastsToDelete));
QueryBuilder query = QueryBuilders.boolQuery().filter(innerBoolQuery);
searchRequest.source(new SearchSourceBuilder().query(query));
request.setQuery(query);
return request;
}
}