ElasticSearch: How do I delete index entries from head?

elasticsearch

Solution

You should have removed the "query" from your post data. You only need it for _search, and you should be using the _query entrypoint for delete. In that case it is obvious the post is only a query, thus making it redendant (and actually irrelevant) to explicitly state it's a query.

That is:

curl -XPOST 'localhost:9200/myindex/mydoc/_search' -d 
'{"query":{"term":{"supplier":"ABC"}}}'

will work fine for search. But to delete by query, if you try:

curl -XDELETE 'localhost:9200/myindex/mydoc/_query' -d 
'{"query":{"term":{"supplier":"ABC"}}}'

it won't work (note the change in entry point to _query, as well as switch CURL parameter to delete). You need to call:

curl -XDELETE 'localhost:9200/myindex/mydoc/_query' -d 
'{"term":{"supplier":"ABC"}}'

Let me know if this helps.

If you want to do it in HEAD:

put `/stock/one/_query` in the any request text box next to the drop-box of "GET/PUT/POST/DELETE"

choose DELETE in the drop-down menu

the request body should be `{"term":{"vendor":"Socks"}}`

Your problem was that you used a request body of: `{"query":{"term":{"vendor":"Socks"}}}` That is fine for search, but not for delete.

Problem

I want to delete index entries directly from MOBZ's ElasticSearch head (web UI). I tried a DELETE query in the "Any Request" section with the following: ``` {"query":{"term":{"supplier":"ABC"}}} ``` However, all I get in return is: ``` { ok: true acknowledged: true } ``` and the entries do not get deleted. What am I doing wrong?

Original source