How come RefreshResponse is missing in 8.13.0. Needed for RHLC compatibility with v8

This file/class exists in 8.12.2 (elasticsearch/server/src/main/java/org/elasticsearch/action/admin/indices/refresh/RefreshResponse.java at v8.12.2 · elastic/elasticsearch · GitHub) but is gone starting in 8.13.0. I didn't see any mention of it in the release notes

The Java High Level REST Client is supposed to be compatible with v8 in compatibility mode, but the API public RefreshResponse refresh(RefreshRequest refreshRequest, RequestOptions options) can no longer work if RefreshResponse is missing...right?

What am I misunderstanding here?

The class you are looking at is on the server side. Not the client side.

The HLClient does not exist after 7.17.
So you should either stay on the 7.17 HLClient (which I don't recommend) or switch to the new client. See my blog post: Switching from the Java High Level Rest Client to the new Java API Client | Elastic Blog

1 Like

I understand that RequestResponse is on the server side but RHLC 7 claims to be compatible with server v8 (using compatibility mode). So I'd expect that a RHLC v7 API continues to work with server v8 libraries.

Secondly, why would RefreshRequest exist but not the RefreshResponse?

So you should either stay on the 7.17 HLClient (which I don't recommend)

ES docs actually outline a migration strategy wherein you continue to use the RHLC v7 until you can slowly switch over to the new java APIs which we're doing.

RefreshResponse exists in the Java API client: elasticsearch-java/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/RefreshResponse.java at main · elastic/elasticsearch-java · GitHub

@swallez I'm not sure, but I don't think the class you linked to helps. The RHLC API uses org.elasticsearch.action.admin.indices.refresh.RefreshResponse but the elasticsearch-java class is in package co.elastic.clients.elasticsearch.indices meaning it's not the same one

It is indeed a different class. The RHLC and Java API client are different libraries that both allow calling the Elasticsearch API.

You can use both in an application, but for a single API call you have to use one or the other. In other words, calling the refresh API with the RHLC will give you a RHLC response.

Calling the refresh API with the Java API client will give you a Java API client response. They both have the same name, are distinct classes that live in different libraries and different packages.

1 Like

I don't understand what you are doing.

If you are using the HLClient 7.17, why do you need the class from the server version 8?
Just use the classes provided by the client.

I don't know where this expectation came from, but its definitely not what "compatible with" means.

The compatibility that is offered is that the HLRC can send JSON requests and receive JSON responses from an Elasticsearch 8.x server. It does not mean that the HLRC uses the server code, or that it is safe to use the HLRC on a classpath that has the 8.x server jars on it.

1 Like

Thanks for all your responses.

This thread was really motivated by upgrading out test infrastructure to use es8 and this thread is related to NPE Initializing PluginsService in ES8 - #3 by buitcj in that our test infra was relying embedded mode. If embedded mode is no longer supported then we don't need to have the es8 server libraries in the same process, and there shouldn't be a library conflict anymore. This now makes sense to me.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.