Feature Request: Expiring Entires

I wasn’t sure where to put this since it likely would deal with Algolia’s inner-workings and not a client.

Anyway - I think an amazing feature to add would be introducing a way to have auto-expiring entries.

For example, you could use a proprietary attribute (like you do now for _geo), and have it be _expirationDate, which would expect a timestamp.
Once a record reached that expiration timestamp, it would be removed.

Similarly, you could do the same for something like _postDate, where if populated, a record wouldn’t appear in results until past that timestamp.

My use-case for it is creating a ebay/craigslist-style marketplace, where users would be posting records that should expire.
Currently I’d have to poll for these changes and periodically keep the algolia records up to date.

Thanks for this request! Your use-case definitely makes sense!

To avoid having relying on products which are or are not in the index, have you considered to:

  • Set an expiryTimestamp in your records as you described
  • At query time, add a filter like this : "expiryTimestamp > " + new Date().getTime()
  • and on a regular basis (say, once a day), delete all the outdated products with a cron job for instance

This might be way less resource intensive for you than a constant polling. :slight_smile:

Yep, I’m doing that with a numericRefinement now, which works.

So I guess ideally my FR would be for the expiration bit, the records would actually get removed so I don’t end up with a huge backlog of expired records.