essuraj
6/28/2018 - 3:43 AM

Range query with aggregation

{
  "_source": [
    "countrycode",
    "city"
  ],
  "query": {
    "bool": {
      "must": [
        {
          "range": {
            "latitude": {
              "gte": "24",
              "lte": "26"
            }
          }
        },
        {
          "range": {
            "longitude": {
              "gte": "82",
              "lte": "84"
            }
          }
        }
      ],
      "must_not": [],
      "should": []
    }
  },
  "from": 0,
  "size": 0,
  "sort": [],
  "aggs": {
    "genres": {
      "terms": {
        "field": "hotelname",
        "size": 9999
      }
    }
  }
}