I have daily indexes in the format of "payments-2021-01-27". When I search documents I send a time based query and I want to distribute search requests to the matched indexes by date.
For example when I search last one month records I only want to search data in last one month's indexes. I shouldn't search documents in older indexes. Is there a method to achieve this?
(Btw, I'm developing with .NET Core and using NEST)
Typically you should just search all the indices and let Elasticsearch determine which ones to skip. If your query contains a filter by a date range then it's automatically optimised up-front into a MatchNoDocsQuery on every shard whose date range doesn't overlap the range in the query. A MatchNoDocsQuery is rather easy to execute
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.