Hello,
As per the topic title, is it possible to delete all data from an index without deleting the index? I don't want to have to recreate the fields and dashboards/visualizations (I know I can export those but still).
Hello,
As per the topic title, is it possible to delete all data from an index without deleting the index? I don't want to have to recreate the fields and dashboards/visualizations (I know I can export those but still).
You can using a delete by query, but it's seriously inefficient.
Would you mind sharing the query?
As long as it deletes everything but leaves the index & visualizations alone I don't mind its inefficient. This is just test data and its not that much data so I don't mind having to wait a bit longer.
Why not just delete the specific index and repopulate?
https://www.elastic.co/guide/en/elasticsearch/reference/5.4/docs-delete-by-query.html
Yes. Just to make sure that everything is clear. When you run a
DELETE my_index
You just remove your index data but you don't touch .kibana
index which contains all the kibana stuff.
I ended up doing that but it looks like you can't use wildcards (e.g twitter-*) so I had to delete 40 indexes by hand.
@dadoonet Thanks, I'll remember that one for next time.
Sure you can.
curl -XDELETE 0:9200/twitter*
.
I couldn't get it working with the example on the user guide.
Anyway I tried @dadoonet 's recommendation and that worked like a charm. Requires the least amount of typing too.
Try escaping the wildcard, like this:
curl -XDELETE 0:9200/twitter-\*
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.