I'm working on a production system that is indexing user's interaction events as documents in Solr index. Each documents looks similar to: {user_id, event_data, update_time} The index size increase monotonously over time and so documents need to be deleted from the index in fixed intervals. A requirement for the deletion process is to delete documents so each user will be left with ~500 of the most updated documents (by update_time field). Another requirement is that deletion process needs to be efficient as there are millions of users and many documents that need to be deleted each time.
Can you advise on how can I implement such deletion mechanism? -Guy