Search code examples
solrsolr4solrcloud

DocExpirationUpdateProcessorFactory not deleting records


I am trying to use the DocExpirationUpdateProcessorFactoryfactory in Solr 4.10.1 version.

I have included the following in my solrconfig.xml

<updateRequestProcessorChain default="true">
    <processor class="solr.UUIDUpdateProcessorFactory">
        <str name="fieldName">id</str>
    </processor>

    <processor class="solr.TimestampUpdateProcessorFactory">
        <str name="fieldName">timestamp</str>
    </processor>
    <processor class="solr.processor.DocExpirationUpdateProcessorFactory">
        <int name="autoDeletePeriodSeconds">30</int>
        <str name="ttlFieldName">ttl</str>
        <str name="expirationFieldName">expire_at</str>
    </processor>
    <processor class="solr.LogUpdateProcessorFactory" />
    <processor class="solr.RunUpdateProcessorFactory" />
</updateRequestProcessorChain>

And I have included the following in my schema.xml

    <field name="timestamp" type="date" indexed="true" stored="true" default="NOW" multiValued="false"/>
    <field name="ttl" type="date" indexed="true" stored="true" default="NOW+60SECONDS" multiValued="false"/>
    <field name="expire_at" type="date" indexed="true" stored="true"  multiValued="false"/>   

As you can see I am setting the time to live to be 60 seconds and checking to delete every 30 seconds, when I insert a document , and check after a minute or couple or an hour it never gets deleted.

This is what I see in the indexed document , can you please let me know what might be the issue here ? Please note that the expire_at field is never getting generated in the Solr document as can be seen below.

"id": "3888a8ac-fbc4-437a-8248-132384753c00",
"timestamp": "2015-02-04T04:09:21.29Z",
"_version_": 1492147724740460500,
"ttl": "2015-02-04T04:10:21.29Z"

Solution

  • This is because I was setting the ttl to be of type date ,it should rather be set to type string and should be set as "+60SECONDS" and not as "NOW+60SECONDS"