Reputation: 2588
I am attempting to delete records from elasticsearch using the delete by query API
Executing:
curl -XDELETE localhost:4040/search/foo/_query -d '{
"term": {
"record id": "0f9eaa6f-90bb-4dee-9ecb-78a5d04719c0"
}
}'
results in:
{
"ok": true,
"_indices": {
"foo": {
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
}
}
}
}
yet, querying:
curl -XGET localhost:4040/search/foo/_search -d '{
"query": {
"match": {
"record id": "0f9eaa6f-90bb-4dee-9ecb-78a5d04719c0"
}
}
}'
gives me:
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
}
}
with the 5 records printed...
I have tried running:
curl -XGET localhost:4040/search/foo/_refresh
but still results are returned?
Upvotes: 0
Views: 1765
Reputation: 30163
You are deleting using the term
query and you are searching using the match
query. These are two different queries. The term
query doesn't analyze the supplied query term while the match
does. So these two queries may produce different results depending on how your record id
field is analyzed.
Upvotes: 3