[英]With Elastic Search, how can I index a document containing an array into multiple documents, one per array item?
[英]How can i search documents based on multiple geopoints in elastic search?
我有一個用例,我想在其中搜索具有多個地理點的文檔。
{
"query": {
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_distance": {
"distance": "100m",
"nc_extraData.nc_geoPoint": {
"lat": 21.36042723377568,
"lon": -5.646749208228298
}
}
}
}
}
}
此查詢僅支持單個地理點。 可能嗎。
您可以添加多個具有不同地理點的geo_distance
約束。 您還可以使用命名查詢知道哪個點匹配:
{
"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"
]``
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.