Hilal
(Hilal)
October 31, 2016, 8:32am
1
Hi,
I want to delete my data on elasticsearch index.
my code:
POST titub2/ihale/_delete_by_query
{
"query": {
"match": {
"dosyaadi": "2014_06-08"
}
}
}
result:
{
"_index": "titub2",
"_type": "ihale",
"_id": "_delete_by_query",
"_version": 12,
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"created": false
}
it can not be deleted. What is the problem?
xavierfacq
(Xavier Facq)
October 31, 2016, 8:48am
2
dadoonet
(David Pilato)
October 31, 2016, 8:49am
3
You just created a document called _delete_by_query
.
My guess is that you are using elasticsearch 2.x and not 5.0, right?
If so, read: https://www.elastic.co/guide/en/elasticsearch/plugins/2.4/delete-by-query-usage.html
Hilal
(Hilal)
October 31, 2016, 8:55am
4
Yes E.S. 2.4.1.
I installed plugin delete_by_query :sudo bin/plugin install delete-by-query
and my code:
DELETE /titub2/ihale/_query
{
"query": {
"term": {
"dosyaadi": "2014_06-08"
}
}
}
result:
{
"took": 0,
"timed_out": false,
"_indices": {
"_all": {
"found": 0,
"deleted": 0,
"missing": 0,
"failed": 0
}
},
"failures": []
}
it could not be deleted. How can I do?
xavierfacq
(Xavier Facq)
October 31, 2016, 9:04am
5
You must search matching documents, and then delete one by one per document ID , using the Bulk will be the better solution.
@see https://www.elastic.co/guide/en/elasticsearch/reference/2.4/docs-bulk.html
Hilal
(Hilal)
October 31, 2016, 9:19am
7
'dosyaadi
' is not date. It is a file name actullay So It is string data type
dadoonet
(David Pilato)
October 31, 2016, 9:38am
8
What gives the following?
GET titub2/ihale/_search
{
"query": {
"term": {
"dosyaadi": "2014_06-08"
}
}
}
Hilal
(Hilal)
October 31, 2016, 10:45am
9
I did:
DELETE /titub2/ihale/_query?q=dosyaadi:2014_06-08
It works true.
Thank you.