我的要求如下:
当我运行以下查询时,Must_not 出现以下错误
<块引用>"reason": "[match] 查询不支持多字段,找到 [app_rating] 和 [satisfaction_rating]"
对于条款,多个字段也出现错误。
<块引用>"reason": "在 [should] 下应该有 [START_OBJECT],但在 [MyBuckets] 中有 [START_ARRAY]",
如何更正查询?
"size":0,
"_source":["comments.keyword"],
"query":{
"bool": {
"must": [
{"match":{"source.keyword": "ONA"}}
],
"must_not":[
{"match":{"app_rating":"0","satisfaction_rating":"0","usability_rating": "0"}}
]
}
},
"aggs": {
"MyBuckets": {
"should":[{
"terms": {
"fields": ["comments.keyword"]
}
},
{
"terms":{
"fields": ["app_rating"]
}
},
{
"terms":{
"fields": ["satisfaction_rating"]
}
},
{
"terms":{
"fields": ["usability_rating"]
}
}
],
"order":{
"_count": "desc"
},
"size": "10"
}
}
}
** Below is the sample Mapping details**
'''{
"mapping": {
"properties": {
"Id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"app_rating": {
"type": "long"
},
"comments": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"conversation_rating": {
"type": "long"
},
"id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"satisfaction_rating": {
"type": "long"
},
"source": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"timestamp": {
"type": "long"
},
"usability_rating": {
"type": "long"
}
}
}
}
答案 0 :(得分:0)
您不能在单个 must_not
子句中使用多个字段,因此您必须添加多个 must_not
子句,而且您正在尝试对各种术语使用术语聚合,并且您的语法不正确导致异常。
能否提供您的索引映射和示例文档,以便我提供工作示例。