我正在尝试在Elasticsearch中编写一个在多个字段上完全匹配的查询
我有以下查询,用于单个字段的完全匹配:
GET /index/data/_search
{
"query": {
"term": {
"table":"abc"
}
}
}
Run Code Online (Sandbox Code Playgroud)
此处的键是“表”,值是“ abc”。我想为精确匹配查询添加另一个名为“ chair”的键,其值为“ def”。
使用bool + must或bool + filter查询,两者均充当逻辑和运算符:
GET /index/data/_search
{
"query": {
"bool": {
"must": [
{
"term": {
"table":"abc"
},
{
"term": {
"chair":"def"
}
]
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
831 次 |
| 最近记录: |