0

Our set up in ES ( 7.x) is to rotate indexes every day in format indexName-yyyy-MM-dd

I'm trying to find the best way to predict the indexes between two days so I can include them in a search request in Java Rest high-level client

As the guide indicates "Limiting the number of indices that are searched reduces the load on the cluster and improves execution performance"

So instead of searching for all indexes indexName-* I'm trying to narrow the index list.

I do have a solution for iterating no of days between From and To and constructing an index list.

for (int j=days; j>=0; i--) {
   /* generate indexnames
   * ( "indexName-" + dateFormatter.format(To.minusDays(day));
   */
}

however, I'm worried about including such a large list if no of days are bigger( maybe what I have is good enough) also trying to avoid a second query ( i can make a query and find out what indexes are available. but not that efficient)

As I know ES will accept indexName-yyyy-MM-* ( wildcards, instead of laying out all the days)

just checking her for any good ideas, suggestions. Thanks in advance

csf
  • 529
  • 1
  • 4
  • 16
  • 1
    Usually `indexName-*` works good enough, load on "wrong" indices is minimal. Also you can check `days` and let's say if it's greater than 10 you use generic wildcard, if it's below - you query specific indices. – ilvar Jan 24 '22 at 17:45

1 Answers1

0

I settled with what I already have with some toleranc

for (int j=days; j>=0; i--) {
   /* generate indexnames
   * ( "indexName-" + dateFormatter.format(To.minusDays(day));
   */
}
csf
  • 529
  • 1
  • 4
  • 16