ElasticSearch: How to remove index entries from the head?

I want to remove index entries directly from the MOBZ ElasticSearch header (web interface).

I tried the DELETE query in the "Any query" section with the following:

{"query":{"term":{"supplier":"ABC"}}} 

However, all that I get in return:

 { ok: true acknowledged: true } 

and records are not deleted.

What am I doing wrong?

+4
source share
2 answers

You should remove the โ€œqueryโ€ from your data. You only need this for _search, and you must use the _query entry point for deletion. In this case, it is obvious that the message is just a request, which makes its redesign (and actually irrelevant) to explicitly indicate the request to it.

I.e:

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

will work just fine for the search. But for uninstall by request, if you try:

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

it will not work (note the change of the entry point to _query, as well as the 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 this in HEAD:

  • put /stock/one/_query in the text box of any query next to the drop-down field "GET / PUT / POST / DELETE"

  • select DELETE from the drop-down menu

  • request body should be {"term":{"vendor":"Socks"}}

Your problem was that you used the request body: {"query":{"term":{"vendor":"Socks"}}} This is fine for searching, but not for deleting.

+5
source

First, I popped up a search query to make sure that the documents you want to delete are actually returned by your query.

It is impossible to give clear help, since there are many things that may go wrong, but here are some possible probes:

  • You do not have the correct index / type specified in the ES Header request
  • You need to specify the index and type in the second input field, and not in the first. The first line is for the host address and automatically adds a trailing slash
  • You need to use the "Delete" command from the drop-down list.
  • Your fields parser modifies the field text so that it is not found in the Term query.

In all likelihood, this is the last option. If you did not specify an analyzer, ES is selected by default, it is a standard analyzer that includes a lower case filter. Therefore, the term โ€œABCโ€ is never indexed; instead, โ€œabcโ€ is indexed.

The term query is not parsed at all, so case sensitivity is important.

If these tips do not help, send your comparison and some example data, and we can probably help better.

0
source

All Articles