This is sample document.
{
"_index": "mqtt-index-2018.01.23",
"_type": "iot_data",
"_id": "AWEjA7LNRU4cTUO-Lyj4",
"_score": null,
"_source": {
"message": "{\"datastream_name\": \"roshni\", \"value\": 12,
\"context\": {\"latitude\": 0, \"elevation\": 0, \"longitude\": 0},
\"device_id\": 31}",
"@version": "1",
"@timestamp": "2018-01-23T12:34:59.687Z",
"host": "iot-elk",
"topic": "telemetry/f2a55827ef554475a41c3c96369957f0/roshni",
"datastream_name": "roshni",
"value": 12,
"context": {
"latitude": 0,
"elevation": 0,
"longitude": 0
},
"device_id": 31,
"tstamp": "2018-01-23T12:34:59.687Z"
},
"fields": {
"tstamp": [
1516710899687
],
"@timestamp": [
1516710899687
]
},
"sort": [
1516710899687
]
}
I want to delete document using device_id field. How to delete it using API call or using python client? I have tried it using Document _id and particular index but i want to delete it by using device_id field or other field.
Deleting document from multiple indices in elasticsearch using following DELETE API call.
curl -XDELETE 'http://localhost:9200/mqtt-index-*/logs/_query' -d '{
"query" : {
"match" : {"device_id": 31}
}
}' -i