Skip to content

Commit 2772c5f

Browse files
committed
Fix missing return value in ByQueryResponse.
Original Pull Request #3109 Closes #3108 Signed-off-by: Peter-Josef Meisch <[email protected]> (cherry picked from commit ebbe242) (cherry picked from commit ea51ce0)
1 parent 144d388 commit 2772c5f

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/main/java/org/springframework/data/elasticsearch/client/elc/ResponseConverter.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,10 @@ public ByQueryResponse byQueryResponse(UpdateByQueryResponse response) {
497497
builder.withDeleted(response.deleted());
498498
}
499499

500+
if(response.updated() != null) {
501+
builder.withUpdated(response.updated());
502+
}
503+
500504
if (response.batches() != null) {
501505
builder.withBatches(Math.toIntExact(response.batches()));
502506
}

src/test/java/org/springframework/data/elasticsearch/core/ElasticsearchIntegrationTests.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1634,7 +1634,9 @@ void shouldDoUpdateByQueryForExistingDocument() {
16341634
.withParams(Collections.singletonMap("newMessage", messageAfterUpdate)).withAbortOnVersionConflict(true)
16351635
.build();
16361636

1637-
operations.updateByQuery(updateQuery, IndexCoordinates.of(indexNameProvider.indexName()));
1637+
var byQueryResponse = operations.updateByQuery(updateQuery, IndexCoordinates.of(indexNameProvider.indexName()));
1638+
1639+
assertThat(byQueryResponse.getUpdated()).isEqualTo(1);
16381640

16391641
SampleEntity indexedEntity = operations.get(documentId, SampleEntity.class,
16401642
IndexCoordinates.of(indexNameProvider.indexName()));

0 commit comments

Comments
 (0)