我正在使用将geo数据插入到下面的引擎中,但是我可以使用什么函数或方法来搜索数据呢?你能举个例子吗?
mappings = {
"doc": {
"properties": {
"geo": {
"properties": {
"location": {"type": "geo_point"}
}
}
}
}
}
es.indices.create(index='geodata', body=mappings)
# ...
es_entries['geo'] = {'location':str(data['_longitude_'])+","+str(data['_latitude_'])}
# ...
es.index(index="geodata", doc_type="doc", body=es_entries)发布于 2016-12-04 00:33:41
您可以使用Geo距离查询:
{
"query": {
"bool" : {
"must" : {
"match_all" : {}
},
"filter" : {
"geo_distance" : {
"distance" : "10km",
"geo.location" : {
"lat" : 10,
"lon" : -10
}
}
}
}
}
}例如,您可以同时使用es.search和elasticsearch.helpers.scan:
res = es.search(index='geodata', body= { ... }) # put the above dictionary in the `body`https://stackoverflow.com/questions/40954086
复制相似问题