I need to delete the multiple record in specified index/type. i follow this document stil i have same issue
I need to delete all documents in gvisitor type in g_visitor index, i follow below command
curl -XDELETE http://10.1.2.10:9200/g_visitor/gvisitor
its throw below error
No handler found for uri [/g_visitor/gvisitor] and method [DELETE]
Then follow to install Delete By Query plugin and try to remove documents ,
curl -XDELETE 'http://10.1.2.10:9200/g_visitor/gvisitor/_delete_by_query?conflicts=proceed' -d '{
"query" : {
"match_all" : {}
}
}'
Its throw below error:
{
"found":false,
"_index":"g_visitor",
"_type":"gvisitor",
"_id":"_delete_by_query",
"_version":1,
"_shards":{
"total":2,
"successful":1,
"failed":0
}
}
Suggeset me, How can i delete multiple or all documents in specific type of index in elasticsearch.
You cannot delete a mapping type, hence why your first query doesn't work.
You can only delete an index
curl -XDELETE http://10.1.2.10:9200/g_visitor
If you want to use the delete-by-query approach, you can do so, but you need to install the plugin first
sudo bin/plugin install delete-by-query
Then you can use the plugin like this by calling the _query
endpoint (not _delete_by_query
!!):
curl -XDELETE 'http://10.1.2.10:9200/g_visitor/gvisitor/_query?conflicts=proceed' -d '{
"query" : {
"match_all" : {}
}
}'