-
Notifications
You must be signed in to change notification settings - Fork 254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I disable api-version-compatibility headers? #76
Comments
Starting with version 7.16, the Java client sends these headers to be compatible with Elasticsearch 8.0 that will have a "7.0 compatible mode" to ease the transition to this new major version. The server-side part of this migration logic was added to Elasticsearch 7.14, and therefore the Java client requires Elasticsearch 7.14 or more. See also our compatibility guarantees. |
Hi there, I'd like to know if the latest version of java API client supports |
Hi @swallez, I found a really wired case: RestClient restClient = RestClient.builder(
new HttpHost("localhost", 9200)).build();
RestHighLevelClient hlrc = new RestHighLevelClientBuilder(restClient)
.setApiCompatibilityMode(false) // disable the compatibility headers
.build();
RestClientOptions restClientOptions = new RestClientOptions(RequestOptions.DEFAULT);
ElasticsearchTransport transport = new RestClientTransport(
hlrc.getLowLevelClient(), new JacksonJsonpMapper(), restClientOptions); // override the default headers
ElasticsearchClient client = new ElasticsearchClient(transport)
.withTransportOptions(restClientOptions); // override the default headers again, it seems this don't override above config Even configured as above, won't disable thoese headers. And it seems something happened here. |
The compatibility mode on the High Level Rest Client only applies to that class, and not to the lower level Rest Client (that one only deals with raw requests and responses). This "opt in" behavior was introduced because it was changing the default behavior of High Level Rest Client. For Java API client we made a different choice: since the compatibility mode is supported in Elasticsearch since version 7.14 and the Java API client was released as GA in 7.16, we decided to always send the version compatibility information to ease the future transition to Elasticsearch version 8.0 without requiring any change to application code. |
Good to know, thanks. |
Since some 7.x service do not support these headers, how can I disable this in Java client?
The text was updated successfully, but these errors were encountered: