I went through the Java-doc @ DocExpirationUpdateProcessorFactory . It says :
The DocExpirationUpdateProcessorFactory provides two features related to the "expiration" of documents which can be used individually, or in combination:
- Computing expiration field values for documents from a "time to live" (TTL)
- Periodically delete documents from the index based on an expiration field
But it didn't specify how expirationField values are calculated from ttl field.
Anybody can help to understand how its calculated?
ttlFieldName
- Name of a field this process should look for in each document processed, defaulting to_ttl_
. If the specified field name exists in a document, the document field value will be parsed as a Date Math Expression relative to NOW and the result will be added to the document using theexpirationFieldName
.
This means that you can use terms like +2 HOURS
in the _ttl_
field to make the document expire in two hours from when it was indexed. This date value will then be stored in the expirationFieldName
field.
From Cloudera's documentation about the introduction of the feature:
Current Time is:
2016-10-26 20:14:00
_ttl_
is defined as: +2HOURSThis will result in an expiration value of
2016-10-26 22:14:00
There are also more examples in Lucidworks description of the feature:
{ "id" : "live_2_minutes_b",
"time_to_live_s" : "+120SECONDS"
},