Skip to content Skip to sidebar Skip to footer

Elasticsearch Delete_by_query Wrong Usage

I am using 2 similar ES methods to load and delete documents: result = es.search(index='users_favourite_documents', doc_type='favourite_document',

Solution 1:

I'v used version 6.2.0 of the Elastic Stack and the use of the API works for deleting like this:

es.delete_by_query(index="index_name", doc_type='doc_type', body={"query":{"match": {"message": "message_value"}}})

if your value is INT remove the "" in message_value.

Solution 2:

If you're running ES 2.x, you need to make sure that you have installed the delete-by-query plugin first:

In your ES_HOME folder, run this:

bin/plugin install delete-by-query

Then restart ES and your es.delete_by_query(...) call will work.

If you're running ES 1.x, then delete-by-query is part of the core and that should work out of the box.

Post a Comment for "Elasticsearch Delete_by_query Wrong Usage"