Delete all data from index without deleting index?

(Sjaak) #1


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).

(Mark Walkom) #2

You can using a delete by query, but it's seriously inefficient.

(Sjaak) #3

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.

(Mark Walkom) #4

Why not just delete the specific index and repopulate?

(David Pilato) #5

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.

(Sjaak) #6

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.

(Mark Walkom) #7

Sure you can.

curl -XDELETE 0:9200/twitter*.

(Sjaak) #8

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.

(Sebastian Lövdahl) #9

Try escaping the wildcard, like this:

curl -XDELETE 0:9200/twitter-\*

(system) #10

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