es数组包含查询

es中字段A 值是一个list a, b, c, d,当入参为a, b, c, d, e 或 a, b, c, d 就可以匹配到;如果是 a, b, c 就匹配不到。

复制代码
{
	"query": {
		"bool": {
			"filter": [{
				"script": {
					"script": {
						"source": """ 
                            List<Integer> fieldAValues = Arrays.asList(doc['field_a'].values()); 
                            List<Integer> searchValues = Arrays.asList(params.searchValues); 
                            return searchValues.stream().allMatch(fieldAValues::contains);
    					""",
						"lang": "painless",
						"params": {
							"searchValues": [a, b, c, d]
						}
					}
				}
			}]
		}
	}
}

该方法比较耗cpu。

其他类似方法:

Fingerprint processor | Elasticsearch Guide 8.6 | Elastic

相关推荐
Elastic 中国社区官方博客1 小时前
Elastic 获得全新的 AWS 数据能力认证
大数据·人工智能·elasticsearch·搜索引擎·ai·云计算·aws
Elasticsearch21 小时前
Elastic 获得全新的 AWS 数据能力认证
elasticsearch
Elasticsearch1 天前
Elastic 安全借助 NVIDIA Nemotron 为物理隔离的安全运营中心提供智能体人工智能
elasticsearch
Elasticsearch1 天前
NVIDIA Nemotron 现已在 Elastic 推理服务(EIS)中可用
elasticsearch
岳涛1 天前
考古|ES 5.1 给别名补上校验,长度上限文档里写 100 字节、5.6.16 源码是 255
elasticsearch
约书亚的博客1 天前
Elasticsearch 常用命令速查:从集群健康到索引与查询
大数据·elasticsearch·搜索引擎
Elasticsearch2 天前
为什么你的 agent 会忘事:值得在其基础上继续开发的记忆系统必须完成的五项任务
elasticsearch
岳涛2 天前
ES 9.2 起 ReadOnly 会设 indexing_complete,此前它要单独配
elasticsearch
喜欢吃燃面3 天前
Git 原理与使用(三):标签、多人协作与 Git Flow 落地
大数据·git·elasticsearch
喜欢吃燃面3 天前
Git 原理与使用(二):分支是平行宇宙,远程仓库是共享时空
大数据·git·elasticsearch