Skip to content

Instantly share code, notes, and snippets.

@satoshikumano
Last active December 17, 2015 07:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save satoshikumano/5576364 to your computer and use it in GitHub Desktop.
Save satoshikumano/5576364 to your computer and use it in GitHub Desktop.

Query

"bucketQuery" : {
  "clause" : {
    "type": "geodistance",
    "field": "mylocation",
    "center": {
        "_type": "point",
        "lat": 11.0,
        "lon": 1.0
    }
    "radius": 1023
    "clauseIdentifier": "restrantsNearMe"
  }
  "offset" : 0,
  "numberOfResults" : 0,
  "orderBy" : "_calculated.restrantsNearMe"
  "descending" : false
}

Result

...

{
  "mylocation": {
    "_type": "point",
    "lat": 11.0,
    "lon": 1.0
  },
  "_id": "0512ca53-4d86-4ee3-b2d0-53de7559c6cc",
  "_modified": 1366965367393,
  "_created": 1366965367393,  
  "_owner": "SYS_ADMIN",
  "_version": "1",
  "_calculated": {
    "restrantsNearMe": 15605.156575746192
  }
}

...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment