spring-data-opensearch
spring-data-opensearch copied to clipboard
[BUG] When requesting deletion via OpenSearchRestTemplate.delete(Query query, Class<?> clazz, IndexCoordinates index), the refresh policy is always IMMEDIATE.
What is the bug?
When requesting deletion through OpenSearchRestTemplate.delete(Query query, Class<?> clazz, IndexCoordinates index), the refresh policy is always IMMEDIATE.
How can one reproduce the bug?
When calling operations.withRefreshPolicy(RefreshPolicy.NONE).delete(deleteQuery, Test.class, indexCoordinates), refresh=true in the actual request query parameter.
What is the expected behavior?
When calling operations.withRefreshPolicy(RefreshPolicy.NONE).delete(deleteQuery, Test.class, indexCoordinates), the request parameter of the actual request must have refresh=false.
What is your host/environment?
host/environment doesn't seem to be relevant.
Do you have any screenshots?
No
Do you have any additional context?
ElasticSearchTemplate.class
public ByQueryResponse delete(Query query, Class<?> clazz, IndexCoordinates index) {
....
DeleteByQueryRequest request = this.requestConverter.documentDeleteByQueryRequest(query, this.routingResolver.getRouting(), clazz, index, this.getRefreshPolicy());
}
OpenSearchRestTemplate.class
public ByQueryResponse delete(Query query, Class<?> clazz, IndexCoordinates index) {
....
// When creating DeleteByQueryRequest, you need to receive refresh policy as an argument and set it.
DeleteByQueryRequest deleteByQueryRequest = this.requestFactory.deleteByQueryRequest(query, this.routingResolver.getRouting(), clazz, index);
}