title: Elasticsearch query for simple category search, sorting by price and getting records by range
body: <p>I want to write query with following condition :</p>
  
  <ul>
  <li>search by category (like category = 'cat1')</li>
  <li>and with price range (and price between 100 to 500)</li>
  <li>and sort by price (low to high)</li>
  </ul>
  
  <p>I tried:</p>
  
  <pre><code>    $params = [
                  'index' =&gt; 'my_index',
                  'type' =&gt; 'product',
                  'body' =&gt;  [
                          //"from" =&gt; 0, "size" =&gt; 2,
                          "sort" =&gt; [
                                      ["default_product_low_price.sale_price" =&gt; ["order" =&gt; "asc"]]
                                  ],
                          'query'=&gt; $query,
                          "aggs" =&gt; [
                          "default_product_low_price" =&gt; [
                          "nested" =&gt; [
                              "path" =&gt; "default_product_low_price"
                              ],
                          "aggs" =&gt; [
                                  "range" =&gt; ["default_product_low_price.sale_price" =&gt; [ "gte" =&gt; '790',
                                  "lte" =&gt; '1000' ]],
                                  //"max_price" =&gt; ["max" =&gt; [ "field" =&gt; "default_product_low_price.sale_price" ]]
                              ],
                          ]
                      ]
                  ]
              ];
  </code></pre>
  
  <p>But I am getting an error</p>
  
  <blockquote>
    <p>Bad Request 400 Exception in GuzzleConnection.php line 277: error.</p>
  </blockquote>
  
  <p>Please guide me where I am wrong? What is the right query?</p>