I have a usecase where I want to search for documents with multiple geopoints.
{
"query": {
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_distance": {
"distance": "100m",
"nc_extraData.nc_geoPoint": {
"lat": 21.36042723377568,
"lon": -5.646749208228298
}
}
}
}
}
}
This query suppports only for single geopoint. Is it possible.
You can add several geo_distance
constraints with different geo points. You can also know which point matched using named queries :
{
"query": {
"bool": {
"should": [
{
"geo_distance": {
"distance": "100m",
"nc_extraData.nc_geoPoint": {
"lat": 21.36042723377568,
"lon": -5.646749208228298
},
"_name": "point 1"
}
},
{
"geo_distance": {
"distance": "100m",
"nc_extraData.nc_geoPoint": {
"lat": 22.36042723377568,
"lon": -6.646749208228298
},
"_name": "point 2"
}
},
{
"geo_distance": {
"distance": "100m",
"nc_extraData.nc_geoPoint": {
"lat": 23.36042723377568,
"lon": -7.646749208228298
},
"_name": "point 3"
}
}
]
}
}
}
"query": {
"bool": {
"should": [
{
"geo_distance": {
"distance": "6000km",
"nc_extraData.nc_geoPoint": {
"lat": 39.783181787374076,
"lon": -100.72051270885312
},
"_name": "point 1"
}
},
{
"geo_distance": {
"distance": "6000km",
"nc_extraData.nc_geoPoint": {
"lat": 39.73750007106965,
"lon": -90.00078544604122
},
"_name": "point 2"
}
},
{
"geo_distance": {
"distance": "1000m",
"nc_extraData.nc_geoPoint": {
"lat": 60.73750007106965,
"lon": -90.00078544604122
},
"_name": "point 3"
}
}
]
}
}
}```
I am trying this query. But the matching query contains both ``` "matched_queries": [
"point 2",
"point 1"
]``
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.