Hello I am new to python and elasticsearch. On my local I have setup Elasticsearch and have added data to it. http://127.0.0.1:9200/index_data/type_data.
I want to delete some _ids from the type_data. suppose the list of _ids are x= ['a','b','c'.'d'] that i want to delete.
curl -XDELETE 'localhost:9200/index_data/type_data/a?pretty'
using this command I was able to delete a particular _id from elasticsearch but how do execute this curl request using python?
Is it possible to delete the entire type_data using python?
why is this code not working?
from elasticsearch import Elasticsearch
es = Elasticsearch()
request_body = {
"query": {
"ids": {
"values": ['a','b','c','d','e','f']
}
}
}
es.delete_by_query(index=es_index, body=request_body)
i am using Elasticsearch version 6.1.0. elasticsearch-py version 5.4.0
Please Help me!