我想根据与geo_point的OR条件查找结果并按距离排序。我在这里发布了我尝试使用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"
}
}
]
}
}
}
}
}
关于php - Elasticsearch 的OR条件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/37163104/