Skip to content

Fix updatebyquery request. #2197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1096,8 +1096,7 @@ public UpdateRequest updateRequest(UpdateQuery query, IndexCoordinates index) {

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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ void shouldUseAllOptionsFromUpdateQuery() {
assertThat(fetchSourceContext.excludes()).containsExactlyInAnyOrder("excl");
}

@Test // #1446
@Test // #1446, #2191
void shouldUseAllOptionsFromUpdateByQuery() throws JSONException {

Query searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery()) //
Expand Down Expand Up @@ -270,9 +270,10 @@ void shouldUseAllOptionsFromUpdateByQuery() throws JSONException {
" }" + " }" + '}';

// 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);
Expand Down