POST indexname/_update_by_query HTTP/1.1 is failing on Elastic Cloud
POST /indexname/_update_by_query HTTP/1.1 is working on Elastic Cloud
POST indexname/_update_by_query HTTP/1.1 is working on the official docker container
POST /indexname/_update_by_query HTTP/1.1 is working on the official docker container
Considering I'm using docker for testing, I would like the same behaviour on my Docker container than on Elastic Cloud. Anyone an idea how to achieve this?
You are focussing on the wrong level. My question is not why it isn't working with or without the backslash. But why the behaviour of the same request is handled differently by the docker container than by the elastico cloud service.
Both lines are giving a 200 when they are run against docker. If similar requests are run against elastic cloud. Only the first line (with the leading slash would work). My question is not why is the slash needed, but rather why is the docker behaving differently than elastic search. Because that way I will notice errors against this in my integration tests.
But to answer your question. At the moment I'm using the org.elasticsearch.client.Restclient from org.elasticsearch.client:elasticsearch-rest-client:5.6.4. I'm using org.elasticsearch.client.RestClient#performRequest(java.lang.String, java.lang.String, java.util.Map<java.lang.String,java.lang.String>, org.apache.http.Header...). And it's in the endpoint parameter that should start with a slash
I'd always use a trailing / at the beginning of a URL.
The main difference that "might" explain that behavior though is that cloud has a proxy in front of the service which docker does not have.
But I'm almost sure that if you try all that with elastic cloud enterprise you will see the same behavior as for elastic cloud as both have a proxy.
That being said, this might be viewed as a bug in the Low Level REST Client as we should never allow sending requests without the leading /. IMHO.
I don't mind to put always / at the beginning of a URL. It bothers me that if I forget it, that my integration tests wouldn't fail, because they are run against the docker container.
I would only notice my error when I test it manually against elastic cloud
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.