Reputation: 247
{
"geo_bounding_box": {
"location": {
"top_right": {
"lat": 4.482137,
"lon": 51.0355306
},
"bottom_left": {
"lat": 4.482137,
"lon": 51.0146768
}
}
}
} .
Convert the above search filter to Elastic search query DSL.(Python)
Upvotes: 2
Views: 435
Reputation: 12672
If you look at the source code, you will find geo_bounding_box filter
, your script should look something like this
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
}
})
Hope this helps!
Upvotes: 4
Reputation: 247
.filter("geo_bounding_box", location = { "top_right" : {"lat": 4.482137, "lon": 51.0355306 }, "bottom_left" : { "lat": 4.482137, "lon": 51.0146768 }}).
This will work !
Upvotes: 0