【发布时间】:2021-08-25 00:22:14
【问题描述】:
我想创建一个可以使用 match 的查询,并且该 match 应该只考虑另一个字段值为 null 或某个特定值的行。
比如:
where field1 like 'string' and field2 is null or field2 = 123
在JS客户端可以吗?
【问题讨论】:
标签: elasticsearch search elasticsearch-dsl
我想创建一个可以使用 match 的查询,并且该 match 应该只考虑另一个字段值为 null 或某个特定值的行。
比如:
where field1 like 'string' and field2 is null or field2 = 123
在JS客户端可以吗?
【问题讨论】:
标签: elasticsearch search elasticsearch-dsl
您可以将bool/must/should 与exists 和wildcard query 结合使用
{
"query": {
"bool": {
"must": [
{
"wildcard": {
"field1": "string*"
}
},
{
"bool": {
"should": [
{
"term": {
"field2": 123
}
},
{
"bool": {
"must_not": {
"exists": {
"field": "field2"
}
}
}
}
]
}
}
]
}
}
}
【讨论】: