martb
September 13, 2018, 12:09pm
1
Hi,
Using the example below how do I delete all documents within an index that match the actype field i.e all REF-3?
{
"_index": "index-names-2018.08.27",
"_type": "doc",
"_id": "XOod0mUBf6rT7tCrMDeP",
"_version": 1,
"_score": null,
"_source": {
"alertid": 6860,
"@version ": "1",
"description": "description heret",
"@timestamp ": "2018-08-27T07:44:14.000Z",
"commentary": "Commentary",
"actype": "REF-3",
Thanks in advance
Martin
jbudz
(Jon Budzenski)
September 13, 2018, 3:11pm
2
You're looking for the delete_by_query api, https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html . I'd give the query a run first before deleting to make sure verything looks okay
curl -X POST "localhost:9200/index-names-2018.08.27/_delete_by_query" -H 'Content-Type: application/json' -d'
{
"query": {
"match": {
"actype": "REF-3"
}
}
}
'
1 Like
martb
September 14, 2018, 9:48am
3
Hi,
This was exactly what I've been looking for. Many thanks
system
(system)
Closed
October 12, 2018, 9:48am
4
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.