We do something similar when we clear elements from one of our indexes using curl and use the timestamp field in the Solr schema.
Here is the curl command that you want to remove in order to remove items older than 30 days (using DateMathParser to calculate based on the current day) using the timestamp
field in the schema.
curl "http://localhost:8983/solr/update?commit=true" -H "Content-Type: text/xml" --data-binary "<delete><query>timestamp:[* TO NOW/DAY-30DAYS]</query></delete>"
Of course, you will need to change the URL to match your solr instance, and you can use a different field.
It also provides a field definition of the timestamp field from the schema.xml file that comes with the Solr distribution in the sample folder.
<field name="timestamp" type="date" indexed="true" stored="true" default="NOW" multiValued="false"/>
source share