请参考:总结——》【Elasticsearch】
一、现象
1、查询语句
GET goods/_search
{
"from": 0,
"size": 10,
"query": {
"bool": {
"must": [
{
"term": {
"couponIds": [1,2]
}
}
]
}
}
}
2、错误现象
{
"error" : {
"root_cause" : [
{
"type" : "parsing_exception",
"reason" : "[term] query does not support array of values",
"line" : 9,
"col" : 26
}
],
"type" : "parsing_exception",
"reason" : "[term] query does not support array of values",
"line" : 9,
"col" : 26
},
"status" : 400
}
二、原因
数组查询要用关键字terms
,不是term
三、解决
GET goods/_search
{
"from": 0,
"size": 10,
"query": {
"bool": {
"must": [
{
"terms": {
"couponIds": [1,2]
}
}
]
}
}
}
更多推荐
Elasticsearch——》解决:[term] query does not support array of values
发布评论