title: Nodejs Elasticsearch query default behaviour
body: <p>On a daily basis, I'm pushing data (time_series) to Elasticsearch. I created an index pattern, and my index have the name: myindex_* , where * is today date (an index pattern has been setup). Thus after a week, I have: <code>myindex_2022-06-20</code>, <code>myindex_2022-06-21</code>... <code>myindex_2022-06-27</code>.</p>
  <p>Let's assume my index is indexing products' prices. Thus inside each <code>myindex_*</code>, I have got:</p>
  <pre><code>    myindex_2022-06-26 is including many products prices like this:
  {
      &quot;reference_code&quot;: &quot;123456789&quot;,
      &quot;price&quot;: 10.00
  },
  ...
  myindex_2022-06-27:
  {
      &quot;reference_code&quot;: &quot;123456789&quot;,
      &quot;price&quot;: 12.00
  },
  </code></pre>
  <p>I'm using this query to get the reference code and the corresponding prices. And it works great.</p>
  <pre><code>const data = await elasticClient.search({
                      index: myindex_2022-06-27,
                      body: {
                          query: {
                              match: {
                                 &quot;reference_code&quot;: &quot;123456789&quot;
                                  }
                          }
                      }
                  });
  </code></pre>
  <p>But, I would like to have a query that if in the index of the date 2022-06-27, there is no data, then it checks, in the previous index 2022-06-26, and so on (until e.g. 10x).</p>
  <p>Not sure, but it seems it's doing this when I replace myindex_2022-06-27 by myindex_* (not sure it's the default behaviour).</p>
  <p>The issue is that when I'm using this way, I got prices from other index but it seems to use the oldest one. I would like to get the newest one instead, thus the opposite way.</p>
  <p>How should I proceed?</p>