Skip to content

Commit

Permalink
ML: Fix build after HLRC change
Browse files Browse the repository at this point in the history
I recently merged a HLRC change that passed the PR builds but didn't
compile after merging. Sad time. This fixes the compilation.
  • Loading branch information
nik9000 committed Sep 4, 2018
1 parent dbc7102 commit ebd5eb6
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,12 @@ private static Set<ForecastRequestStats> parseForecastsFromSearch(SearchResponse
}

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(),
Expand All @@ -213,7 +210,7 @@ private DeleteByQueryRequest buildDeleteByQuery(String jobId, List<String> forec
forecastsToDelete));

QueryBuilder query = QueryBuilders.boolQuery().filter(innerBoolQuery);
searchRequest.source(new SearchSourceBuilder().query(query));
request.setQuery(query);
return request;
}
}

0 comments on commit ebd5eb6

Please sign in to comment.