【发布时间】:2012-05-14 03:35:54
【问题描述】:
来自此处的文档:http://www.elasticsearch.org/guide/reference/mapping/geo-point-type.html
它说 geo_point 接受不同的格式。例如:这两个都支持
“位置”:“-71.34, 41.12”
“位置”:{ “纬度”:41.12, “隆”:-71.34 }
我想问一下这两个是一样的吗? 我正在使用 ES 0.17.6 并遇到此问题:
当我使用 (1) 格式进行索引时,我无法使用 (2) 格式进行搜索。如果 我用(1)格式再次搜索,成功了。
例如: 如果我使用 (2) 格式进行索引:
curl -XPUT 'http://localhost:9200/twitter/pin/1' -d '
{
"pin" : {
"location" : {
lat: 41.12,
lon: -71.34
},
"tag" : ["food", "family"],
"text" : "my favorite family restaurant"
}
}'
我无法使用这种 (1) 格式进行搜索
curl -XGET 'http://localhost:9200/twitter/pin/_search' -d '
{
"query": {
"filtered" : {
"query" : {
"field" : { "text" : "restaurant" }
},
"filter" : {
"geo_distance" : {
"distance" : "12km",
"pin.location" : "-71.34, 41.12"
}
}
}
}
}
'
如果我使用(2)格式搜索就会成功:
2. "pin.location" : {
"lat" : 41.12,
"lon" : -71.34
}
【问题讨论】:
标签: java lucene geolocation elasticsearch