Skip to content

fix bug: IndexQuery's id get ignored in bulkIndexOperation #2407

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 2 commits into from
Dec 27, 2022
Merged
Changes from 1 commit
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 @@ -96,6 +96,7 @@
* @author Peter-Josef Meisch
* @author Sascha Woo
* @author cdalxndr
* @author scoobyzhang
* @since 4.4
*/
class RequestConverter {
Expand Down Expand Up @@ -440,7 +441,7 @@ public IndexRequest<?> documentIndexRequest(IndexQuery query, IndexCoordinates i
Object queryObject = query.getObject();

if (queryObject != null) {
String id = !StringUtils.hasText(query.getId()) ? getPersistentEntityId(queryObject) : query.getId();
String id = StringUtils.hasText(query.getId()) ? query.getId() : getPersistentEntityId(queryObject);
builder //
.id(id) //
.document(elasticsearchConverter.mapObject(queryObject));
Expand Down Expand Up @@ -492,7 +493,7 @@ private IndexOperation<?> bulkIndexOperation(IndexQuery query, IndexCoordinates
Object queryObject = query.getObject();

if (queryObject != null) {
String id = StringUtils.hasText(query.getId()) ? getPersistentEntityId(queryObject) : query.getId();
String id = StringUtils.hasText(query.getId()) ? query.getId() : getPersistentEntityId(queryObject);
builder //
.id(id) //
.document(elasticsearchConverter.mapObject(queryObject));
Expand Down Expand Up @@ -533,7 +534,7 @@ private CreateOperation<?> bulkCreateOperation(IndexQuery query, IndexCoordinate
Object queryObject = query.getObject();

if (queryObject != null) {
String id = StringUtils.hasText(query.getId()) ? getPersistentEntityId(queryObject) : query.getId();
String id = StringUtils.hasText(query.getId()) ? query.getId() : getPersistentEntityId(queryObject);
builder //
.id(id) //
.document(elasticsearchConverter.mapObject(queryObject));
Expand Down