如何在此 elasticsearch 查询中添加另一个过滤条件?
How can I add another condition to filter on in this elasticsearch query?
我有一个在 business_process 字段上过滤的 elasticsearch 查询。我想添加另一个匹配子句,以便两个字段都具有指定的数据,并且我想在 business_process 字段上添加突出显示。我将如何在弹性中做到这一点?先感谢您。
{
"query": {
"filtered": {
"query": {
"match": {
"business_process": "loading"
}
},
"filter": {
"missing": {
"field": "client_cru_all"
}
}
}
}
}
ES 文档是你的朋友。 bool query 可能是您要查找的内容。像这样的东西应该做你想要的。
POST /test_index/_search
{
"query": {
"filtered": {
"query": {
"bool": {
"must": [
{
"match": {
"business_process": "loading"
}
},
{
"match": {
"another_field": "some text"
}
}
]
}
},
"filter": {
"missing": {
"field": "client_cru_all"
}
}
}
}
}
就突出显示而言,我会开始 here。如果你不能让它工作,post你在你的问题中尝试了什么。
我有一个在 business_process 字段上过滤的 elasticsearch 查询。我想添加另一个匹配子句,以便两个字段都具有指定的数据,并且我想在 business_process 字段上添加突出显示。我将如何在弹性中做到这一点?先感谢您。
{
"query": {
"filtered": {
"query": {
"match": {
"business_process": "loading"
}
},
"filter": {
"missing": {
"field": "client_cru_all"
}
}
}
}
}
ES 文档是你的朋友。 bool query 可能是您要查找的内容。像这样的东西应该做你想要的。
POST /test_index/_search
{
"query": {
"filtered": {
"query": {
"bool": {
"must": [
{
"match": {
"business_process": "loading"
}
},
{
"match": {
"another_field": "some text"
}
}
]
}
},
"filter": {
"missing": {
"field": "client_cru_all"
}
}
}
}
}
就突出显示而言,我会开始 here。如果你不能让它工作,post你在你的问题中尝试了什么。