【发布时间】:2023-04-04 11:59:01
【问题描述】:
我的 elasticsearch DSL 存在问题,在使用分面导航时,当我应用分面过滤器时,下一组结果不包含任何其他分面,即使我已经要求它们。
当我进行初始搜索时,我得到了我想要的结果:
{
"sort": {
"_score": {},
"salesQuantity": {
"order": "asc"
}
},
"query": {
"filtered": {
"query": {
"match": {
"categoryTree": "D01"
}
},
"filter": {
"term": {
"publicwebEnabled": true,
"parentID": 0
}
}
}
},
"facets": {
"delivery_locations": {
"terms": {
"field": "delivery_locations",
"all_terms": true
}
},
"categories": {
"terms": {
"field": "categoryTree",
"all_terms": true
}
},
"collectable": {
"terms": {
"field": "collectable",
"all_terms": true
}
}
},
"from": 0,
"size": 12}
当我像这样应用过滤器时,我得到的结果不包括方面:
{
"sort": {
"_score": {},
"salesQuantity": {
"order": "asc"
}
},
"query": {
"filtered": {
"query": {
"match": {
"categoryTree": "D01"
}
},
"filter": {
"term": {
"publicwebEnabled": true,
"parentID": 0
},
"or": [
{
"range": {
"Retail_Price": {
"to": "49.99",
"from": "0"
}
}
}
]
}
}
},
"facets": {
"delivery_locations": {
"terms": {
"field": "delivery_locations",
"all_terms": true
}
},
"categories": {
"terms": {
"field": "categoryTree",
"all_terms": true
}
},
"collectable": {
"terms": {
"field": "collectable",
"all_terms": true
}
}
},
"from": 0,
"size": 12}
注意,我在上面添加 OR 过滤器 - 因为用户可以选择多个价格范围进行过滤。
我做错了吗?
我希望返回新的方面,因为更改价格显然会改变其他方面的方面数...
【问题讨论】:
-
我看到的完全一样。当我的查询块包含“过滤”部分时,我不会在结果中得到任何方面
标签: elasticsearch