-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
type: enhancementA general enhancementA general enhancement
Milestone
Description
Elasticsearch Official Documentation say can use HEAD to check document exists.
In Spring Data Elasticsearch Project, ElasticsearchTemplate#doExists(String, IndexCoordinates)
use GetRequest, maybe can use ExistsRequest to replace it。
current code:
@Override
protected boolean doExists(String id, IndexCoordinates index) {
Assert.notNull(id, "id must not be null");
Assert.notNull(index, "index must not be null");
GetRequest request = requestConverter.documentGetRequest(id, routingResolver.getRouting(), index, true);
return execute(client -> client.get(request, EntityAsMap.class)).found();
}
after:
@Override
protected boolean doExists(String id, IndexCoordinates index) {
Assert.notNull(id, "id must not be null");
Assert.notNull(index, "index must not be null");
// the method is not exists, need to add
ExistsRequest request = requestConverter.documentExistsRequest(id, routingResolver.getRouting(), index);
return execute(client -> client.exists(request)).value();
}
Metadata
Metadata
Assignees
Labels
type: enhancementA general enhancementA general enhancement