I want to delete the 5 days old data of all my indexes. How to curl this query to shell script
POST _all/_delete_by_query
{
"query": {
"range": {
"@timestamp": {
"lte": "now-5d"
}
}
}
}
Thanks in advance!
I want to delete the 5 days old data of all my indexes. How to curl this query to shell script
POST _all/_delete_by_query
{
"query": {
"range": {
"@timestamp": {
"lte": "now-5d"
}
}
}
}
Thanks in advance!
Hi
Have a look into Kibana's Console
curl -XPOST "{Elasticsearch}/_all/_delete_by_query" -H 'Content-Type: application/json' -d'
{
"query": {
"range": {
"@timestamp": {
"lte": "now-5d"
}
}
}
}'
Best,
Matthias
You're welcome!
Hope these aren't your real credentials
Good day, the updated solution that works for me.
curl -XPOST "YourLocalhost:9200/YourIndexName/_delete_by_query" -H 'Content-Type: application/json' -d' { "query": { "range": { "@timestamp": { "lte": "now-5d" } } } }' -u YourElasticUsername:AndPassword
I added my Elastic Username and Password to the last of the command.
Thank you!
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.