# Java RestLowLevelClient: BadRequest on Delete By Query

**URL:** <https://discuss.elastic.co/t/java-restlowlevelclient-badrequest-on-delete-by-query/132462>\
**Category:** Elasticsearch\
**Created:** [May 18, 2018, 10:15am UTC](https://discuss.elastic.co/t/java-restlowlevelclient-badrequest-on-delete-by-query/132462 "2018-05-18T10:15:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![freddy79](https://avatars.discourse-cdn.com/v4/letter/f/dfb087/32.png) [@freddy79](https://discuss.elastic.co/u/freddy79)\
**Post date:** [May 18, 2018, 10:15am UTC](https://discuss.elastic.co/t/java-restlowlevelclient-badrequest-on-delete-by-query/132462/1 "2018-05-18T10:15:09Z")

</div>

Hey, we are using:

- Elasticsearch 6.2.3 hosted by [http://cloud.elastic.co](http://cloud.elastic.co)
- Java RestLowLevelClient 6.2.3

**Request with low level client:**

```
	restHighLevelClient.getLowLevelClient().performRequest(
	"POST",
	"INDEX/_delete_by_query?conflicts=proceed",
	Collections.emptyMap(),
	new StringEntity("{\"query\":{\"match_all\":{}}}", APPLICATION_JSON));

```

**Response:**

```
Caused by: org.elasticsearch.client.ResponseException: method [POST], host [HOST], URI [HOST/_delete_by_query], status line [HTTP/1.1 400 BAD_REQUEST]
	at org.elasticsearch.client.RestClient$1.completed(RestClient.java:357)
	at org.elasticsearch.client.RestClient$1.completed(RestClient.java:346)
	at org.apache.http.concurrent.BasicFuture.completed(BasicFuture.java:123)
	at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.responseCompleted(DefaultClientExchangeHandlerImpl.java:181)
	at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.processResponse(HttpAsyncRequestExecutor.java:436)
	at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.inputReady(HttpAsyncRequestExecutor.java:326)
	at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:265)
	at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81)
	at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39)
	at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:121)
	at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162)
	at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337)
	at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315)
	at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276)
	at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
	at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:588)
	... 1 common frames omitted

```

The requests works fine when i execute with kibana or the RestClient plugin for firefox.  
With the JavaLowLevel Client i could also add and remove an alias. But delete by query does not work.

There are no logs regarding to the delete by query request in elasticsearch.

Any tips? Thanks.

---

<div class="post-metadata">

**Author:** ![freddy79](https://avatars.discourse-cdn.com/v4/letter/f/dfb087/32.png) [@freddy79](https://discuss.elastic.co/u/freddy79)\
**Post date:** [May 18, 2018, 12:54pm UTC](https://discuss.elastic.co/t/java-restlowlevelclient-badrequest-on-delete-by-query/132462/2 "2018-05-18T12:54:15Z")

</div>

Found the error.  
I had to put a slash "/" before the index. 😅

```
"/INDEX/_delete_by_query?conflicts=proceed"
```

---

<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:** [June 15, 2018, 12:54pm UTC](https://discuss.elastic.co/t/java-restlowlevelclient-badrequest-on-delete-by-query/132462/3 "2018-06-15T12:54:18Z")

</div>

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