弹性搜索的查询结构是什么?
我有一个产品数据库与相关的位置。我想按名称和位置搜索产品。我觉得正确的位置似乎是在位置上进行分面搜索。
它的查询结构是什么?谢谢!
(如果您可以展示使用Tire gem for Rails的示例,我将以您的名字命名我的第一个孩子)
发布于 2012-01-18 18:45:07
这样如何:
{
"query" : {
"field" : { "text" : "restaurant" }
},
"facets" : {
"geo1" : {
"geo_distance" : {
"pin.location" : {
"lat" : 40,
"lon" : -70
},
"ranges" : [
{ "to" : 10 },
{ "from" : 10, "to" : 20 },
{ "from" : 20, "to" : 100 },
{ "from" : 100 }
]
}
}
}
}更多信息请点击这里:http://www.elasticsearch.org/blog/2010/08/16/geo_location_and_search.html
https://stackoverflow.com/questions/8899962
复制相似问题