title: elasticsearch/elastica limit nested results
body: <p>is it possible to limit the results from a nested field ? </p>
  
  <p>I have shop owners and shops and for my search results i want to get only 2 shops and not all elements from a owner.</p>
  
  <p>my setup is foselasticabundle 5.0 + elasticsearch 5.4.3</p>
  
  <p>i have tried it with the following query:
  <code></p>
  
  <pre><code>$query = new Query();
  $query-&gt;setParams(
      [
          'query' =&gt; [
              'bool' =&gt; [
                  'must' =&gt; [
                      [
                          'match' =&gt; [
                              '_all' =&gt; $term,
                          ],
                      ],
                      [
                          'nested' =&gt; [
                              'path' =&gt; 'shops',
                              'score_mode' =&gt; 'max',
                              'inner_hits' =&gt; [
                                  'size' =&gt; 2,
                              ],
                              'query' =&gt; [
                                  'match_all' =&gt; ['boost' =&gt; 1.0],
                              ],
                          ],
                      ],
                  ],
              ],
          ],
      ]
  );
  $found = $this-&gt;index-&gt;getType('owner')-&gt;search($query);
  </code></pre>
  
  <p></code></p>
  
  <p>the query works, but the size parameter is ignored</p>
  
  <p>type definition:
  <code>
  types:
      owner:
          properties:
              name: { boost: 10, analyzer: snowball }
              created: { type: date }
              shops:
                  type: nested
                  properties:
                      name: ~
                      address:
                          type: nested
                          properties:
                              city: ~
                              street: ~
                              zip: ~
          persistence:
              driver: orm
              model: AppBundle\Entity\Owner
              provider: ~
              finder: ~
  </code></p>
  
  <p>and here is is a example document:
  <code></p>
  
  <pre><code>{
      "took": 1,
      "timed_out": false,
      "_shards": {
          "total": 5,
          "successful": 5,
          "failed": 0
      },
      "hits": {
          "total": 4,
          "max_score": 1.0,
          "hits": [
              {
                  "_index": "app_dev",
                  "_type": "owner",
                  "_id": "9",
                  "_score": 1.0,
                  "_source": {
                      "name": "Demo Name",
                      "created": "2017-06-30T22:46:47+02:00",
                      "shops": [
                          {
                              "name": "Shop 1 ",
                              "address": {
                                  "city": "Test",
                                  "street": "Teststreet 123",
                                  "zip": "1234"
                              }
                          },
                          {
                              "name": "Shop 2",
                              "address": {
                                  "city": "Test",
                                  "street": "Teststreet 123",
                                  "zip": "1234"
                              }
                          },
                          {
                              "name": "Shop 3",
                              "address": {
                                  "city": "Test",
                                  "street": "Teststreet 123",
                                  "zip": "1234"
                              }
                          }
                      ]
                  }
              }
          ]
      }
  }
  </code></pre>
  
  <p></code></p>