gpt4 book ai didi

elasticsearch - Elasticsearch geo_point query_parsing_exception

转载 作者:行者123 更新时间:2023-12-03 01:51:31 25 4
gpt4 key购买 nike

我试图通过索引单个文档来遵循文档中的示例:

curl -XPUT 'localhost:9200/graph/nodes/1' -d'
{
"pin" : {
"location" : {
"lat" : 40.12,
"lon" : -71.34
}
}
}
'

这给出了映射:
{
"graph" : {
"mappings" : {
"nodes" : {
"properties" : {
"location" : {
"type" : "double"
},
"pin" : {
"properties" : {
"location" : {
"properties" : {
"lat" : {
"type" : "double"
},
"lon" : {
"type" : "double"
}
}
}
}
},
"text" : {
"type" : "string"
}
}
}
}
}
}

当我尝试按距某点的距离进行查询时,出现如下错误:
failed to find geo_point field [pin.location]

我给出的查询如下:
curl -XPOST 'localhost:9200/graph/_search?pretty' -d'
{
"query" : {
"bool":{
"must":{
"match_all":{}
},
"filter":{
"geo_distance":{
"distance":"200km",
"pin.location":{
"lat":40,
"lon":-70
}
}
}
}
}
}
}
'

我不确定在这里哪里出错了,所以任何建议都很棒!

提前致谢

最佳答案

要使用地理位置查询,您的位置必须为geo_point或geo_shape类型。

将您的映射更改为

"pin" : {
"properties" : {
"location" : {
"type" : "geo_point"
}
}
}

关于elasticsearch - Elasticsearch geo_point query_parsing_exception,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40075724/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com