elasticsearch 地理点距离的弹性搜索查询,elasticsearch,kibana,elasticsearch,Kibana" /> elasticsearch 地理点距离的弹性搜索查询,elasticsearch,kibana,elasticsearch,Kibana" />

elasticsearch 地理点距离的弹性搜索查询

elasticsearch 地理点距离的弹性搜索查询,elasticsearch,kibana,elasticsearch,Kibana,我想通过客户点获得交付半径内的资源。 我的映射如下所示: "restaurantPoint" => [ "type" => "geo_point" ], "deliveryRadius" => [ "type" => "float" ] 以及以下样本数据: `"restaurantPoint": "35.73701996471125,51.409086138010025", "deliveryRadius": 1` 因此,每个餐厅

我想通过客户点获得交付半径内的资源。 我的映射如下所示:

 "restaurantPoint"       => [
 "type" => "geo_point"
 ],
 "deliveryRadius"        => [
 "type" => "float"
 ]
以及以下样本数据:

`"restaurantPoint": "35.73701996471125,51.409086138010025",
"deliveryRadius": 1`
因此,每个餐厅都有一个点和一个以公里为单位的配送半径,另一方面,我们知道用户点。 在查询中,我想找到可以将食物运送到用户位置的餐厅。 我必须检查餐厅点和用户点之间的距离是否小于等于餐厅配送半径

例如,如果用户和餐厅之间的距离为1公里,餐厅配送半径为2公里,则我们可以选择该距离

文档不完整,无法找到解决方案。

最后我使用了脚本:

GET development-restaurants/restaurants/_search
{
    "query": {
        "bool" : {
        "must" : {
            "script" : {
                "script" : {
                    "source": "doc['restaurantPoint'].arcDistance(35.73702, 51.40909) <= doc['deliveryRadius'].value",
                    "lang": "painless"
                 }
            }
        }
     }
  }
}
获取开发餐厅/餐厅/\u搜索
{
“查询”:{
“布尔”:{
“必须”:{
“脚本”:{
“脚本”:{
“source”:“doc['restaurantPoint'].arcdestance(35.73702,51.40909)最后我使用了脚本:

GET development-restaurants/restaurants/_search
{
    "query": {
        "bool" : {
        "must" : {
            "script" : {
                "script" : {
                    "source": "doc['restaurantPoint'].arcDistance(35.73702, 51.40909) <= doc['deliveryRadius'].value",
                    "lang": "painless"
                 }
            }
        }
     }
  }
}
获取开发餐厅/餐厅/\u搜索
{
“查询”:{
“布尔”:{
“必须”:{
“脚本”:{
“脚本”:{
“来源”:“文件['restaurantPoint'].arcDistance(35.73702,51.40909)