# Leading backslash important in Elastic Cloud but not in the official docker container

**URL:** <https://discuss.elastic.co/t/leading-backslash-important-in-elastic-cloud-but-not-in-the-official-docker-container/117292>\
**Category:** Elasticsearch\
**Created:** [January 27, 2018, 9:05am UTC](https://discuss.elastic.co/t/leading-backslash-important-in-elastic-cloud-but-not-in-the-official-docker-container/117292 "2018-01-27T09:05:34Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![robisrob](https://avatars.discourse-cdn.com/v4/letter/r/898d66/32.png) [@robisrob](https://discuss.elastic.co/u/robisrob)\
**Post date:** [January 27, 2018, 9:05am UTC](https://discuss.elastic.co/t/leading-backslash-important-in-elastic-cloud-but-not-in-the-official-docker-container/117292/1 "2018-01-27T09:05:34Z")

</div>

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?

Thx

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 27, 2018, 9:18am UTC](https://discuss.elastic.co/t/leading-backslash-important-in-elastic-cloud-but-not-in-the-official-docker-container/117292/2 "2018-01-27T09:18:51Z")

</div>

Where are you running these commands from?

---

<div class="post-metadata">

**Author:** ![robisrob](https://avatars.discourse-cdn.com/v4/letter/r/898d66/32.png) [@robisrob](https://discuss.elastic.co/u/robisrob)\
**Post date:** [January 27, 2018, 9:35am UTC](https://discuss.elastic.co/t/leading-backslash-important-in-elastic-cloud-but-not-in-the-official-docker-container/117292/3 "2018-01-27T09:35:03Z")

</div>

From a java application that is running locally on my Mac. The docker containers are running also locally on my Mac.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 27, 2018, 9:35am UTC](https://discuss.elastic.co/t/leading-backslash-important-in-elastic-cloud-but-not-in-the-official-docker-container/117292/4 "2018-01-27T09:35:43Z")

</div>

Can you show the logs?

---

<div class="post-metadata">

**Author:** ![robisrob](https://avatars.discourse-cdn.com/v4/letter/r/898d66/32.png) [@robisrob](https://discuss.elastic.co/u/robisrob)\
**Post date:** [January 27, 2018, 9:48am UTC](https://discuss.elastic.co/t/leading-backslash-important-in-elastic-cloud-but-not-in-the-official-docker-container/117292/5 "2018-01-27T09:48:53Z")

</div>

Caused by: org.elasticsearch.client.ResponseException: POST https://url:9243indexname/\_update\_by\_query: HTTP/1.1 400 BAD\_REQUEST

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 27, 2018, 10:33am UTC](https://discuss.elastic.co/t/leading-backslash-important-in-elastic-cloud-but-not-in-the-official-docker-container/117292/6 "2018-01-27T10:33:15Z")

</div>

Can you share your Java code? Which Java client are you using?

---

<div class="post-metadata">

**Author:** ![robisrob](https://avatars.discourse-cdn.com/v4/letter/r/898d66/32.png) [@robisrob](https://discuss.elastic.co/u/robisrob)\
**Post date:** [January 27, 2018, 11:21am UTC](https://discuss.elastic.co/t/leading-backslash-important-in-elastic-cloud-but-not-in-the-official-docker-container/117292/7 "2018-01-27T11:21:34Z")

</div>

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.

The following lines are captured by WireShark

"38773","228.447656","127.0.0.1","127.0.0.1","HTTP","568","POST /queue\_1/\_update\_by\_query HTTP/1.1 (text/plain)"  
"38923","450.564002","127.0.0.1","127.0.0.1","HTTP","567","POST queue\_1/\_update\_by\_query HTTP/1.1 (text/plain)"

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

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 27, 2018, 11:41am UTC](https://discuss.elastic.co/t/leading-backslash-important-in-elastic-cloud-but-not-in-the-official-docker-container/117292/8 "2018-01-27T11:41:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![robisrob](https://avatars.discourse-cdn.com/v4/letter/r/898d66/32.png) [@robisrob](https://discuss.elastic.co/u/robisrob)\
**Post date:** [January 27, 2018, 8:02pm UTC](https://discuss.elastic.co/t/leading-backslash-important-in-elastic-cloud-but-not-in-the-official-docker-container/117292/9 "2018-01-27T20:02:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 24, 2018, 8:03pm UTC](https://discuss.elastic.co/t/leading-backslash-important-in-elastic-cloud-but-not-in-the-official-docker-container/117292/10 "2018-02-24T20:03:16Z")

</div>

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