title: how to combine results from 2 elasticsearch indexes with different layouts
body: <p>We have an elasticsearch with 2 different indexes. In one index there is a field called <code>physical_location</code> which contains a lat en lon subfield. in the other index there is a field called <code>program_run.geolocation</code> with the same nested lat and lon.</p>
  <p>Now we want to plot documents from both indexes on a map in our client web application. we tried using a boolean query</p>
  <pre><code>{
    &quot;query&quot;: {
      &quot;bool&quot;: {
        &quot;should&quot;: [
          {
            &quot;geo_distance&quot;: {
            &quot;distance&quot;: &quot;10km&quot;,
            &quot;physical_location&quot;: {
              &quot;lat&quot;: 53.193078596551715,
              &quot;lon&quot;: 6.783202751724139
            }
          }
          },
          
          {
            &quot;geo_distance&quot;: {
            &quot;distance&quot;: &quot;10km&quot;,
            &quot;program_run.geolocation&quot;: {
              &quot;lat&quot;: 53.193078596551715,
              &quot;lon&quot;: 6.783202751724139
            }
          }
        } 
          ]
      }
    }
  }
  
  </code></pre>
  <p>but this does give an error, because elastic cant find the first field in the second index and the second field in the first index.</p>
  <p>What is the best way of fixing this?</p>
  <ul>
  <li>Is there a server side way of combining queries for different indexes with different layouts without errors?</li>
  <li>or is it more handy to combine on the client? (and how to deal with aggregate counts in that case)</li>
  <li>or is the only way out reindexing and making the names the same in both indexes? (requires lots of refactor work).</li>
  </ul>