title: Object Array search support in Elasticsearch
body: <p>I have a array of object in elastic search. </p>
  
  <p>I would like to search if a particular field value appears in top 2 position of the array <em>without using script</em>.</p>
  
  <p>Imagine my ES data is as follows</p>
  
  <pre><code>[
    {
      "_id": "TestID1",
      "data": [
        {
          "name": "Test1",
          "priority": 2
        },
        {
          "name": "Test2",
          "priority": 3
        },
        {
          "name": "Test3",
          "priority": 4
        }
      ]
    },
    {
      "_id": "TestID2",
      "data": [
        {
          "name": "Test3",
          "priority": 2
        },
        {
          "name": "Test9",
          "priority": 3
        },
        {
          "name": "Test5",
          "priority": 4
        },
        {
          "name": "Test10",
          "priority": 5
        }
      ]
    },
    {
      "_id": "TestID3",
      "data": [
        {
          "name": "Test1",
          "priority": 2
        },
        {
          "name": "Test2",
          "priority": 3
        },
        {
          "name": "Test3",
          "priority": 6
        }
      ]
    }
  ]
  </code></pre>
  
  <p>Here I would like to make a query which searches for <code>_Test3_</code> <em>ONLY</em> within the top 2 elements of the data array. </p>
  
  <p>Searching here would return the result </p>
  
  <p><code>_id: TestID2's</code> data </p>
  
  <p>because only <code>TestID2</code> has <code>Test3</code> in the top 2 of the data array.</p>