我使用ElasticSearch 7.0,我有一个简单的查询:
"bool": {
"must": {
"match": {
"title": {
"query": "engineer"
}
}
},
"filter": {
"0": {
"term": {
"type_id": 1
}
},
"term": {
"active": 1
}
}
}
我得到了一个错误:
匹配格式错误的查询,期望END_OBJECT但找到FIELD_NAME
我试过:
"must": {
"match": {
"title": "engineer"
}
},
但是同样的错误,我在这里看不到我的语法错误?我有相同的查询,用相同的过滤器处理多层程序。
发布于 2019-10-06 01:49:04
您的过滤器必须包含在数组中,如下所示:
{
"bool": {
"must": {
"match": {
"title": {
"query": "engineer"
}
}
},
"filter": [
{
"term": {
"type_id": 1
}
},
{
"term": {
"active": 1
}
}
]
}
}
https://stackoverflow.com/questions/58256014
复制