我的个人博客:逐步前行STEP
1、搜索 数组字段 tags 中同时存在元素 str_a、str_b
{
"query": {
"bool": {
"filter": [
{
"term": {
"tags": "str_a"
}
},
{
"term": {
"tags": "str_b"
}
}
]
}
}
}
2、搜索 数组字段 tags 中存在元素 str_a 或 str_b
{
"query": {
"bool": {
"filter": [
{
"terms": {
"tags": [
"str_a",
"str_b"
]
}
}
]
}
}
}
本文深入探讨了在Elasticsearch中使用布尔过滤器进行精确查询的方法。包括如何同时或选择性地搜索数组字段中的多个元素,这对于高效管理和检索大规模数据集至关重要。
558

被折叠的 条评论
为什么被折叠?



