mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-15 08:32:18 +00:00
Fix updatebyquery request.
Original Pull Request #2197 Closes #2191 (cherry picked from commit f90138076659e5452fd38444c85cfee0745b074c)
This commit is contained in:
parent
98d1f5bf63
commit
ae66cbd619
@ -1092,8 +1092,7 @@ class RequestFactory {
|
|||||||
|
|
||||||
public UpdateByQueryRequest updateByQueryRequest(UpdateQuery query, IndexCoordinates index) {
|
public UpdateByQueryRequest updateByQueryRequest(UpdateQuery query, IndexCoordinates index) {
|
||||||
|
|
||||||
String indexName = index.getIndexName();
|
final UpdateByQueryRequest updateByQueryRequest = new UpdateByQueryRequest(index.getIndexNames());
|
||||||
final UpdateByQueryRequest updateByQueryRequest = new UpdateByQueryRequest(indexName);
|
|
||||||
updateByQueryRequest.setScript(getScript(query));
|
updateByQueryRequest.setScript(getScript(query));
|
||||||
|
|
||||||
if (query.getAbortOnVersionConflict() != null) {
|
if (query.getAbortOnVersionConflict() != null) {
|
||||||
|
@ -239,7 +239,7 @@ public class ElasticsearchERHLCIntegrationTests extends ElasticsearchIntegration
|
|||||||
assertThat(fetchSourceContext.excludes()).containsExactlyInAnyOrder("excl");
|
assertThat(fetchSourceContext.excludes()).containsExactlyInAnyOrder("excl");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test // #1446
|
@Test // #1446, #2191
|
||||||
void shouldUseAllOptionsFromUpdateByQuery() throws JSONException {
|
void shouldUseAllOptionsFromUpdateByQuery() throws JSONException {
|
||||||
|
|
||||||
Query searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery()) //
|
Query searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery()) //
|
||||||
@ -269,9 +269,10 @@ public class ElasticsearchERHLCIntegrationTests extends ElasticsearchIntegration
|
|||||||
" }" + " }" + '}';
|
" }" + " }" + '}';
|
||||||
|
|
||||||
// when
|
// when
|
||||||
UpdateByQueryRequest request = getRequestFactory().updateByQueryRequest(updateQuery, IndexCoordinates.of("index"));
|
UpdateByQueryRequest request = getRequestFactory().updateByQueryRequest(updateQuery, IndexCoordinates.of("index1", "index2"));
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
assertThat(request.indices()).containsExactlyInAnyOrder("index1", "index2");
|
||||||
assertThat(request).isNotNull();
|
assertThat(request).isNotNull();
|
||||||
assertThat(request.getSearchRequest().indicesOptions()).usingRecursiveComparison()
|
assertThat(request.getSearchRequest().indicesOptions()).usingRecursiveComparison()
|
||||||
.isEqualTo(IndicesOptions.LENIENT_EXPAND_OPEN);
|
.isEqualTo(IndicesOptions.LENIENT_EXPAND_OPEN);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user