Deleting document by query

I am trying to use delete_by_query to delete some documents for a particular index. But it fails with illegal version value and I read that delete_by_query cannot be used to delete documents with index version zero. Is there any particular reason why is it so? And also is there any way to delete documents with index version zero as I can't delete the entire index. This is in production and high priority.

Error:
Validation Failed: 1: illegal version value [0] for version type [INTERNAL];

Request to help. Thanks in advance.

Please share the query you are running and the full output from Elasticsearch.

We don't provide SLAs here, but we do our best :slight_smile:

curl -X POST "localhost:9200/my-index-000001,my-index-000002/_delete_by_query?pretty" -H 'Content-Type: application/json' -d'
{
"query": {
"match_all": {}
}
}
'

------------------------- Error while deleting

"error": {

"root_cause": [

{

"type": "action_request_validation_exception",

"reason": "Validation Failed: 1: illegal version value [0] for version type [INTERNAL];2: illegal version value [0] for version type [INTERNAL];3: illegal version value [0] for version type [INTERNAL];4: illegal version value [0] for version type [INTERNAL];5: illegal version value [0] for version type [INTERNAL];6: illegal version value [0] for version type [INTERNAL];7: illegal version value [0] for version type [INTERNAL];8: illegal version value [0] for version type [INTERNAL];9: illegal version value [0] for version type [INTERNAL];10: illegal version value [0] for version type [INTERNAL];11: illegal version value [0] for version type [INTERNAL];12: illegal version value [0] for version type [INTERNAL];13: illegal version value [0] for version type [INTERNAL];14: illegal version value [0] for version type [INTERNAL];15: illegal version value [0] for version type [INTERNAL];16: illegal version value [0] for version type [INTERNAL];17: illegal version value [0] for version type [INTERNAL];18: illegal version value [0] for version type [INTERNAL];19: illegal version value [0] for version type [INTERNAL];20: illegal version value [0] for version type [INTERNAL];21: illegal version value [0] for version type [INTERNAL];22: illegal version value [0] for version type [INTERNAL];23: illegal version value [0] for version type [INTERNAL];24: illegal version value [0] for version type [INTERNAL];25: illegal version value [0] for version type [INTERNAL];26: illegal version value [0] for version type [INTERNAL];27: illegal version value [0] for version type [INTERNAL];"

}

],

"type": "action_request_validation_exception",

"reason": "Validation Failed: 1: illegal version value [0] for version type [INTERNAL];2: illegal version value [0] for version type [INTERNAL];3: illegal version value [0] for version type [INTERNAL];4: illegal version value [0] for version type [INTERNAL];5: illegal version value [0] for version type [INTERNAL];6: illegal version value [0] for version type [INTERNAL];7: illegal version value [0] for version type [INTERNAL];8: illegal version value [0] for version type [INTERNAL];9: illegal version value [0] for version type [INTERNAL];10: illegal version value [0] for version type [INTERNAL];11: illegal version value [0] for version type [INTERNAL];12: illegal version value [0] for version type [INTERNAL];13: illegal version value [0] for version type [INTERNAL];14: illegal version value [0] for version type [INTERNAL];15: illegal version value [0] for version type [INTERNAL];16: illegal version value [0] for version type [INTERNAL];17: illegal version value [0] for version type [INTERNAL];18: illegal version value [0] for version type [INTERNAL];19: illegal version value [0] for version type [INTERNAL];20: illegal version value [0] for version type [INTERNAL];21: illegal version value [0] for version type [INTERNAL];22: illegal version value [0] for version type [INTERNAL];23: illegal version value [0] for version type [INTERNAL];24: illegal version value [0] for version type [INTERNAL];25: illegal version value [0] for version type [INTERNAL];26: illegal version value [0] for version type [INTERNAL];27: illegal version value [0] for version type [INTERNAL];"

},

"status": 400

Please format your code/logs/config using the </> button, or markdown style back ticks. It helps to make things easy to read which helps us help you :slight_smile:

Why don't you just delete the indices if you are deleting all the documents in them anyway?

I hope, it will work for my deleted ones! The first example I found as the described one was like perfect https://ejemplius.com/muestras-de-ensayos/contrato-social/ sample. Unfortunately, I didn't understand at that moment what it was. But when I read twice, it became more clear. And now I hope to get more help!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.