Skip to content

Commit

Permalink
Allowing id field.
Browse files Browse the repository at this point in the history
Signed-off-by: jzonthemtn <[email protected]>
  • Loading branch information
jzonthemtn committed Dec 11, 2024
1 parent 399efbb commit 8b378f0
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,14 @@ public void onResponse(final SearchResponse searchResponse) {

for (final SearchHit hit : searchResponse.getHits().getHits()) {

final Map<String, Object> sourceAsMap = hit.getSourceAsMap();
final String documentId = sourceAsMap.get(idField).toString();
final String documentId;

if("_id".equals(idField)) {
documentId = hit.getId();
} else {
final Map<String, Object> sourceAsMap = hit.getSourceAsMap();
documentId = sourceAsMap.get(idField).toString();
}

orderedDocumentIds.add(documentId);

Expand Down

0 comments on commit 8b378f0

Please sign in to comment.