[es/snapshot.create] Missing [X-Elastic-Product] header
See original GitHub issueElasticsearch version (bin/elasticsearch --version
): 7.16.2
Plugins installed: []
JVM version (java -version
):
openjdk version "11.0.13" 2021-10-19
OpenJDK Runtime Environment (build 11.0.13+8-Ubuntu-0ubuntu1.21.10)
OpenJDK 64-Bit Server VM (build 11.0.13+8-Ubuntu-0ubuntu1.21.10, mixed mode, sharing)
OS version (uname -a
if on a Unix-like system):
Linux pop-os 5.15.8-76051508-generic #202112141040~1639505278~21.10~0ede46a SMP Tue Dec 14 22:38:29 U x86_64 x86_64 x86_64 GNU/Linux
Description of the problem including expected versus actual behavior:
When performing a snapshot using the new Java client, it fails due to missing X-Elastic-Product
header sent by Elasticsearch.
Steps to reproduce:
Please include a minimal but complete recreation of the problem, including (e.g.) index creation, mappings, settings, query etc. The easier you make for us to reproduce it, the more likely that somebody will take the time to look at it.
- Create an FS repository,
- Create a snapshot using the new java client:
final CreateSnapshotRequest request = new CreateSnapshotRequest
.Builder()
.repository(repository)
.snapshot(name)
.waitForCompletion(waitForCompletion)
.build();
client.create(request);
Client being used (maven dep):
<elasticsearch.version>7.16.2</elasticsearch.version>
...
<dependency>
<groupId>co.elastic.clients</groupId>
<artifactId>elasticsearch-java</artifactId>
<version>${elasticsearch.version}</version>
</dependency>
- The code throws an exception.
Provide logs (if relevant):
co.elastic.clients.transport.TransportException: [es/snapshot.create] Missing [X-Elastic-Product] header. Please check that you are connecting to an Elasticsearch instance, and that any networking filters are preserving that header.
at co.elastic.clients.transport.rest_client.RestClientTransport.checkProductHeader(RestClientTransport.java:340)
at co.elastic.clients.transport.rest_client.RestClientTransport.getHighLevelResponse(RestClientTransport.java:250)
at co.elastic.clients.transport.rest_client.RestClientTransport.performRequest(RestClientTransport.java:144)
at co.elastic.clients.elasticsearch.snapshot.ElasticsearchSnapshotClient.create(ElasticsearchSnapshotClient.java:142)
Issue Analytics
- State:
- Created 2 years ago
- Comments:21 (11 by maintainers)
Top GitHub Comments
I ran into the same exact problem with just a search call against ElasticSearch 6.8. Could you perhaps make this check configurable in the client instead of hard-coding for the snapshot case like you did in the workaround?
Otherwise, is there an older version of the client that does not perform this check that I could use?
@mertkinag please read the compatibiity policy: https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/introduction.html
So you cannot use the Java API client with Elasticsearch 6.x. The High Level Rest Client (version 6) works fine though.