gpt4 book ai didi

elasticsearch - elasticsearch过滤器聚合将无法正常工作

转载 作者:行者123 更新时间:2023-12-03 02:00:43 24 4
gpt4 key购买 nike

this帖子一样,我无法使过滤器agg正常工作:

GET files/_search
{
"query": {
"match": {
"words": "sugar"
}
},
"aggs": {
"xxx": {
"filters": {
"filter_list": {
"errors": {
"term": {
"abstract": "error"
}
},
"warnings": {
"term": {
"abstract": "warning"
}
}
}
},
"aggs": {
"st": {
"significant_terms": {
"field": "abstract"
}
}
}
}
}
}

SearchParseException[[files][3]: query[words:sugar],from[-1],size[-1]: Parse Failure [Unknown key for a START_OBJECT in [xxx]: [filter_list].]]; }{[tIS8uY8nTDil6kWtgsbkQg][files][4]: SearchParseException[[files][4]: query[words:sugar],from[-1],size[-1]: Parse Failure [Failed to parse source [{\n \"query\": {\n
\"match\": {\n \"words\": \"sugar\"\n }\n },\n \"aggs\": {\n \"xxx\": {\n \"filters\": {\n \"filter_list\": {\n
\"errors\": {\n \"term\": {\n \"abstract\": \"error\"\n }\n },\n \"warnings\": {\n
\"term\": {\n \"abstract\": \"warning\"\n }\n }\n }\n },\n \"aggs\": {\n \"st\": {\n
\"significant_terms\": {\n \"field\": \"abstract\"\n
}\n }\n }\n }\n }\n}\n]]]; nested: SearchParseException[[epars][4]: query[words:sugar],from[-1],size[-1]: Parse Failure [Unknown key for a START_OBJECT in [xxx]: [filter_list].]]; }]", "status": 400 }

最佳答案

您只有一件事是错的,即filter_list应该读取filters,因为它是 filters aggregation的必需元素。

GET files/_search
{
"query": {
"match": {
"words": "sugar"
}
},
"aggs": {
"xxx": {
"filters": {
"filters": { <---- change this
"errors": {
"term": {
"abstract": "error"
}
},
"warnings": {
"term": {
"abstract": "warning"
}
}
}
},
"aggs": {
"st": {
"significant_terms": {
"field": "abstract"
}
}
}
}
}
}

关于elasticsearch - elasticsearch过滤器聚合将无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32899486/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com