{
"geo_bounding_box": {
"location": {
"top_right": {
"lat": 4.482137,
"lon": 51.0355306
},
"bottom_left": {
"lat": 4.482137,
"lon": 51.0146768
}
}
}
} .
将上述搜索过滤器转换为弹性搜索查询DSL。(Python)
答案 0 :(得分:3)
如果查看source code,您会发现geo_bounding_box filter
,您的脚本应该是这样的
from elasticsearch import Elasticsearch
from elasticsearch_dsl import Search
client = Elasticsearch()
s = Search(using=client, index="my_index") \
.filter("geo_bounding_box", location={
"top_right": {
"lat": 4.482137,
"lon": 51.0355306
},
"bottom_left": {
"lat": 4.482137,
"lon": 51.0146768
}
})
希望这有帮助!
答案 1 :(得分:0)
.filter(“geo_bounding_box”,location = {“top_right”:{“lat”:4.482137,“lon”:51.0355306},“bottom_left”:{“lat”:4.482137,“lon”:51.0146768}})
这会有效!