title: Nested search query in Elasticsearch with range filter and unknown names of inner fields
body: <p>I am storing data in elasticsearch database and am trying to query it, filtered by range of numbers.</p>
  
  <p>This is minimized structure of a document in my database:</p>
  
  <pre><code>"a": {
      "b": {
          "x": [1, 2, 3, 4], // note: x, y and z are not compulsory
          "y": [2, 3, 4], // some documents can have only x or z or maybe x and z etc.
          "z": [5, 6]
      }
  }
  </code></pre>
  
  <p>Now I want my query to return all documents, where there is in any of subfields of "b" at least one number in the range between 2 and 4. Important thing here is that I don't know the names of all subfields of "b".</p>
  
  <p>The query I came up with is:</p>
  
  <pre><code>POST /i/t/_search
  {
      "query": {
          "query_string": {
              "fields": ["a.b.*"],
              "query": "number:[2 TO 4]"
          }          
      }
  }
  </code></pre>
  
  <p>The query doesn't rise an error, but also returns no result. I am not really even sure, which kind of search query would even be most appropriate for such task. I only used Query String because it was the only one I found where I could join unknown field name and range.</p>