Search code examples
javakotlinelasticsearchspring-data-elasticsearch

Spring Data elasticsearch UpdateQuery withRefreshPolicy not working


I use ElasticsearchOperations to implement update operations.

esOperations.update(
    UpdateQuery.builder(old.id.toString())
        .withDocument(Document.from(mapOf("browsed" to item.browsed)))
        .withRefreshPolicy(
            RefreshPolicy.IMMEDIATE
        )
        .build(),
    IndexCoordinates.of("t_telegram_message")
)

But it's not working properly, the post request is

POST /t_telegram_message/_update/6150?refresh=false

What I expect is that the request parameter is refresh=true.

what should I do?

Dependencies:

<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>5.0.3</version>

Solution

  • That was a bug in Spring Data Elasticsearch, thanks for reporting; I just fixed it in main and backported it to the 5.1 and 5.0 branches.