需要帮助将此查询从使用facet_filter转换为在ES 2.0中使用aggs,因为ES 2.0及更高版本不再支持facet。
{
"facets": {
"format": {
"terms": {
"field": "documentary_tag_id",
"size": 10,
"exclude": ["2"]
},
"facet_filter": {
"term": {
"documentary_tag_id": ["2"]
}
}
}
},
"sort": [
"_score",
{
"documentary_tag_name": {
"order": "desc"
}
}
]
}
答案 0 :(得分:1)
聚合几乎与你应该使用smth一样
GET _search
{
"aggs": {
"format_filter": {
"filter": {
"terms": {
"documentary_tag_id": [
"2"
]
}
},
"aggs": {
"format": {
"terms": {
"field": "documentary_tag_id",
"exclude" : "2"
}
}
}
}
}
}
但如果你are filtering有一点不同的想法,要读取你需要获得的值 format_filter ,那么你会发现聚合。聚合内部的Filtering是相同的