First off, please don't optimize unless you're willing to do it every time, there's a long discussion of why here: https://issues.apache.org/jira/browse/LUCENE-7976.
It's almost always a bad idea to optimize unless you're willing to optimize every time you update your index. But second, this is a straight-forward delete-by-query. Something like solr_url/collection/update?stream.body=<delete><query>date_field:[* TO NOW/DAY-3DAYS]</query></delete> You have to have enabled stream.body in recent Solrs, or curl it in or send it from SolrJ, you haven't said how you are doing your indexing yet. The "date math" bit (NOW/DAY-3DAYS) means "everything prior to midnight three days ago. Best, Erick On Thu, Dec 28, 2017 at 10:53 AM, ppeddi <phani.pe...@gmail.com> wrote: > hi, > Can anyone please post the syntax or some examples for deleting solr data > and index older than 3 days based on datetime field in solr collection. > > I have field data_Start_time which stores the date value in and is of type > 'date' in my solr collection. I want to delete the index/data older than 3 > days and then optimize the collection. > > Please let me know the syntax. > > Thanks, > Ppeddi > > > > > -- > Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html