Delete oldest X documents from index

Hi all,

I want to delete the oldest X docs from my elasticsearch index.
How do I do that?

Thanks, Ophir

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/04e6e4b0-2498-4be8-893d-01059e6f1a69%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

You could add datetime field to your document and order by that in
ascending order and get the first X document id's. And then delete the
documents by id.

While that's the solution to the question you asked, it might be better to
re-think your problem so that you don't have to delete the oldest X
documents. Have you considered whether your problem fits into the
time-series index model? If it does, then you can just delete the oldest
day (or whatever time period). Take a look at this
video: http://www.elasticsearch.org/videos/big-data-search-and-analytics/
(about 21:15 minute mark).

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/e215f898-562f-4fa1-9052-c0130ab6ee8c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.