Elasticsearch按照据离排序并展示据离带分页

index:user_location

geo_point字段:location

 

GET /user_location/_search
{
  "from":0,
  "size":5,
  "query": {
    "constant_score": {
      "filter": {
        "geo_distance": {
          "distance": "100km",
          "location": {
            "lat": 39.918340,
            "lon": 116.221540
          }
        }
      },
      "boost": 1.2
    }
  },"sort": [
    {
  "_geo_distance" : {
    "location" : [
      {
        "lat" : 39.991741,
        "lon" : 116.221345
      }
    ],
    "unit" : "km",
    "distance_type" : "arc",
    "order" : "asc",
    "validation_method" : "STRICT"
    }
  }
  ]
}

你可能感兴趣的:(elasticsearch,elasticsearch)