Custom term dictionary

I have a use case where I want to get latest record for a terms filter. I am not interested in its score so its okay even if its not scored. I want this on 5 fields in an index.

  1. One option is to have 5 indexes with these fields as key so that they are unique within an index.
  2. The other option is to use as single index and use aggregate query or field collapse query on each of the 5 fields and sort by timestamp to get latest.

I was wondering if there is a solution using single index where I can have custom terms dictionary / doc values where instead of storing all the docs we'll just store one doc. With this approach the term filter query will return only one document without any aggregation. Is it possible to write a plugin that extends terms dictionary / doc values to achieve this?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.