elasticsearch - Elasticsearch过滤器在Poi附近

标签 elasticsearch elasticsearch-6

我想对Elastic执行以下伪查询:

SELECT SomeTypeOfObjects WHERE distance to 
PointOfInterests < 20km AND PointOfInterests.type = 'bar';

我在Elastic中有以下数据:
SomeTypeOfObjects (around 10.000.000 rows)
----------
id = x
geo_location = x,x

PointOfInterests( around 400.000 rows )
---------
id = x
geo_location = x,x
type=bar, hospital, etc

如果没有2个查询或向查询提供所有可能的地理位置,这是否可能?

最佳答案

如果您将经纬度另存为geo-point,则应该能够执行 geo_distance 查询,如下所示:

GET /my_locations/location/_search
{
    "query": {
        "bool" : {
            "must" : {
                "match_all" : {}
            },
            "filter" : {
                "geo_distance" : {
                    "distance" : "12km",
                    "pin.location" : {
                        "lat" : 40,
                        "lon" : -70
                    }
                }
            }
        }
    }
}

显然无法回答您的问题。我想最好的选择是
1.获取所有条形的坐标
2.对多个点使用geo_distance:
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-distance-query.html

关于elasticsearch - Elasticsearch过滤器在Poi附近,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48564871/

相关文章:

ruby-on-rails - rails : can I use elasticsearch-model and active_model_serializers together?

search - 返回 "search term"以及结果 - Elasticsearch

elasticsearch - Elasticsearch不包含嵌套值的项目汇总

spring - Spring数据版本兼容性VS Elasticsearch版本兼容性

elasticsearch - 简单请求(A或B)和(C或D)

elasticsearch - 使用Elastic Search,如何将包含数组的文档索引为多个文档,每个数组项一个?

elasticsearch - 如何使用Logstash解析日志

spring-boot - Kubernetes-通过minikube中的Spring Boot应用程序连接Elasticsearch

Elasticsearch:如何在过滤器上下文中编写 'OR' 子句?

elasticsearch - Elasticsearch “match_phrase”查询和 “fuzzy”查询-可以结合使用