【发布时间】:2016-10-16 21:32:51
【问题描述】:
我尝试通过索引单个文档来遵循文档中的示例:
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
}
}
}
}
}
}
}
'
我不确定我在哪里出错了,所以任何建议都会很棒!
提前致谢
【问题讨论】:
标签: elasticsearch