I'm deleting a bunch a documents in elasticsearch
using helpers.streaming_bulk
from the python library
for ok, results in helpers.streaming_bulk(
_es_session.es_client,
operations,
max_retries=20,
raise_on_error=False,
refresh=True,
):
action, result = results.popitem()
logging.warning(
{"message": "Delete operation", "details": result, "_id": result["_id"]}
)
In this case operations
is a list of deletes that look like
{
"_index": "xxx",
"_id": msg_id,
"_op_type": "delete",
"_routing": routing,
}
I'm logging the results of every delete operation and I just found one that looks like that
{
"message": "Delete operation",
"details": {
"_index": "xxx",
"_type": "_doc",
"_id": "5e66366e42c85a0701986c1e",
"_version": 416147310420656688,
"result": "deleted",
"forced_refresh": true,
"_shards": {"total": 2, "successful": 2, "failed": 0},
"_seq_no": 4930576,
"_primary_term": 1,
"status": 200
},
"_id": "5e66366e42c85a0701986c1e",
"Module": "root",
"Severity": "WARNING"
}
As you can see the status is 200, but when I run that query
GET /enriched_reviews_v9/_search
{
"query": {
"ids": {"values": ["5e66366e42c85a0701986c1e"]}
},
"_source": false
}
it returns the document.
I am missing something? Why is this delete operation reported as success if the document is still there (I'm forcing a refresh)