Open a point in time API error after Elastic Client upgrade

We are upgrading our application from Java 11 → 17 and Spring boot 2.x.x → 3.5.6.

Before the upgrade, we used RestHighLevelClient 7.17 and Elasticsearch 7.17 on the server.

We replaced RestHighLevelClient with ElasticsearchClient (8.18 comes with Spring boot 3.5.6) and made all the necessary code changes. We are still using Elasticsearch 7.17 on the server.

After the upgrade, I am having an issue using the “open a point in time” API.

OpenPointInTimeRequest request = new OpenPointInTimeRequest.Builder()
        .index(indexName)
        .keepAlive(Time.of(t -> t.time(keepalive.toMinutes() + "m")))
        .build();

OpenPointInTimeResponse openPointInTimeResponse = client.openPointInTime(request);

After the last line is executed, I get below error:

failed co.elastic.clients.elasticsearch._types.ElasticsearchException: [es/open_point_in_time] failed: [illegal_argument_exception] request [POST /equity_symbols/_pit] does not support having a body
at co.elastic.clients.transport.ElasticsearchTransportBase.getApiResponse(ElasticsearchTransportBase.java:357)
at co.elastic.clients.transport.ElasticsearchTransportBase.performRequest(ElasticsearchTransportBase.java:141)
at co.elastic.clients.elasticsearch.ElasticsearchClient.openPointInTime(ElasticsearchClient.java:4169)

It worked fine prior to making any code change, and the code change for this particular API was minimal. Not sure why this is happening. Could there be a compatibility issue when ElasticsearchClient 8.18 tries to talk to Elasticsearch 7.17?

I would really appreciate any help/suggestion.

Regards,

Sang

According to the documentation around REST API compatibility Elasticsearch is compatible with the last version, so it is recommended to first upgrade the server and then the client. I would never use a newer client with an older version of Elasticsearch, so would not be surprised if there is a compatibility issue.

Yes very definitely. The 8.18 client is not compatible with a 7.17 server. Refer to its docs:

The Elasticsearch Java client is forward compatible; meaning that the client supports communicating with greater or equal minor versions of Elasticsearch without breaking.

2 Likes