Curl Xdelete with ELASTICSEARCH 6.1

Hello

Do you know how I can delete document in one curl command ?
I have a index called "myindex". I want to delete all document where the field prediction is like "yes"

With Elasticsearch 2.1, I use:

curl.exe -XDELETE http://XX.XX.XX.XX:9200/myindex/core2/_query?q=prediction:yes

With Elasticsearch 6.1.1, it does not work.

Thanks.

You can use the delete-by-query API.

The syntax you have was for ES 2.4. With ES 5 the delete by query API endpoint has changed name, from _query to _delete_by_query, so this should work (also make sure to use the POST method and not DELETE):

curl.exe -XPOST http://XX.XX.XX.XX:9200/myindex/core2/_delete_by_query?q=prediction:yes

1 Like

Thanks!

It's ok with this syntax:

E:\curl.exe -XPOST http://xx.xx.xx.xx:9200/myindex/_delete_by_query?q=Prediction:yes 2>$NULL

Great, glad to hear it worked out!

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