title: Sequential Searching Across Multiple Indexes In Elasticsearch
body: <p>Suppose I have Elasticsearch indexes in the following order:</p>
  <pre><code>index-2022-04
  index-2022-05
  index-2022-06
  ...
  </code></pre>
  <p><code>index-2022-04</code> represents the data stored in the month of April 2022, <code>index-2022-05</code> represents the data stored in the month of May 2022, and so on. Now let's say in my query payload, I have the following timestamp range:</p>
  <pre><code>&quot;range&quot;: {
      &quot;timestampRange&quot;: {
          &quot;gte&quot;: &quot;2022-04-05T01:00:00.708363&quot;,  
          &quot;lte&quot;: &quot;2022-06-06T23:00:00.373772&quot;                 
      }
  }
  </code></pre>
  <p>The above range states that I want to query the data that exists between the 5th of April till the 6th of May. That would mean that I have to query for the data inside three indexes, <code>index-2022-04</code>, <code>index-2022-05</code> and <code>index-2022-06</code>. Is there a simple and efficient way of performing this query across those three indexes without having to query for each index one-by-one?</p>
  <p>I am using Python to handle the query, and I am aware that I can query across different indexes at the same time (<a href="https://stackoverflow.com/a/62578067/12632899">see this SO post</a>). Any tips or pointers would be helpful, thanks.</p>