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 [email protected].
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.

Reply via email to