Delete document from elastic search


I want to delete some document which type is mytype1.

curl -XDELETE 'http://localhost:9200/logstash-databases-info/mytype1/_query' -d '{

"query" : {
"match_all" : {}

This throwing following log:

Can you please suggest this?

It's looks like you are mixing up two different APIs.

There is the Delete API which deletes a specific document by id

curl -X DELETE 'http://localhost:9200/logstash-databases-info/mytype1/1'

And there is the Delete By Query API which deletes documents matching a query

curl -X POST 'http://localhost:9200/logstash-databases-info/mytype1/_delete_by_query -d '{ .... }'

Also, when posting on these forums, please include the version of Elasticsearch you are running, and take the time to format your post correctly (e.g. marking terminal commands as code blocks) using the buttons at the top of the editor window.

Thanks Tim for reply.

I'm using Elasticsearch 2.3. I tried second API which is not working. is it correct?

This is compatible for Elasticsearch 2.3 ?

In the future please include your Elasticsearch version in your post. Things change quite dramatically between releases and we will end up giving you the wrong advice if we guess the wrong version.

The documentation for delete-by-query in 2.3 is here:

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