How to find Retraurants in given longitude and latitude

HI,
Suppose I give assign id's to restraurant and want to get all the id's in given region when given longitude and latitude is given?Please find the below query and changes that need to be made.Thank you in advance.
GET /Restraurants/Grate_A/_search
{
"query" : {
"constant_score" : {
"filter" : {
"bool" : {
"should" : [
{ "term" : {"City" : "Dallas"}}
],
sort: {
_geo_distance: {
location: "#{80},#{180}",
order: "asc",
unit: "mi"
}

          }
       }

Does this not work?

No Bro,It is not working

Hi :raised_hand:

Maybe some JSON structure error.
how about this?

GET /Restraurants/Grate_A/_search
{
  "query": {
    "constant_score": {
      "filter": {
        "bool": {
          "should": [
            {
              "term": {
                "City": "Dallas"
              }
            }
          ]
        }
      }
    }
  },
  "sort": [
    {
      "_geo_distance": {
        "location": "#{80},#{180}",
        "order": "asc",
        "unit": "mi"
      }
    }
  ]
}

I created the query above by Console (Sence) but I don't have any data for it.
So please test it in your environment.

thanks.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.