[英]OR condition for Elastic search
我試圖找到基於OR條件的結果與geo_point並按距離排序。 我在這里發布了我為OR條件嘗試過的代碼。 這顯示我錯誤沒有為[should]注冊的查詢
{
"query": {
"filtered": {
"filter": {
"geo_distance": {
"distance": "5000km",
"location": {
"lat": 28.613939,
"lon": 77.209021
}
},
"bool": {
"should": [
{
"term": {
"maincat_id": "55b2326501fcff8a338b4569"
}
}
]
}
}
}}}
但它顯示我錯誤[geo_distance]查詢不支持[bool]請幫我解決
這個怎么樣 ?
{
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"geo_distance": {
"distance": "5000km",
"location": {
"lat": 28.613939,
"lon": 77.209021
}
}
}
],
"should": [
{
"term": {
"maincat_id": "55b2326501fcff8a338b4569"
}
},
{
"term": {
"maincat_id": "55b2326501fcff8a338b4578"
}
},
{
"term": {
"maincat_id": "567a47e801fcff55228b4567"
}
}
]
}
}
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.