Java RestLowLevelClient: BadRequest on Delete By Query


#1

Hey, we are using:

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.


#2

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

"/INDEX/_delete_by_query?conflicts=proceed"

(system) #3

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