Fix updatebyquery request.

Original Pull Request #2197
Closes #2191
This commit is contained in:
Peter-Josef Meisch 2022-06-25 19:55:22 +02:00 committed by GitHub
parent 1e4b70ba6d
commit f901380766
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -1096,8 +1096,7 @@ class RequestFactory {
public UpdateByQueryRequest updateByQueryRequest(UpdateQuery query, IndexCoordinates index) {
String indexName = index.getIndexName();
final UpdateByQueryRequest updateByQueryRequest = new UpdateByQueryRequest(indexName);
final UpdateByQueryRequest updateByQueryRequest = new UpdateByQueryRequest(index.getIndexNames());
updateByQueryRequest.setScript(getScript(query));
if (query.getAbortOnVersionConflict() != null) {

View File

@ -240,7 +240,7 @@ public class ElasticsearchERHLCIntegrationTests extends ElasticsearchIntegration
assertThat(fetchSourceContext.excludes()).containsExactlyInAnyOrder("excl");
}
@Test // #1446
@Test // #1446, #2191
void shouldUseAllOptionsFromUpdateByQuery() throws JSONException {
Query searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery()) //
@ -270,9 +270,10 @@ public class ElasticsearchERHLCIntegrationTests extends ElasticsearchIntegration
" }" + " }" + '}';
// when
UpdateByQueryRequest request = getRequestFactory().updateByQueryRequest(updateQuery, IndexCoordinates.of("index"));
UpdateByQueryRequest request = getRequestFactory().updateByQueryRequest(updateQuery, IndexCoordinates.of("index1", "index2"));
// then
assertThat(request.indices()).containsExactlyInAnyOrder("index1", "index2");
assertThat(request).isNotNull();
assertThat(request.getSearchRequest().indicesOptions()).usingRecursiveComparison()
.isEqualTo(IndicesOptions.LENIENT_EXPAND_OPEN);