es数组包含查询

es中字段A 值是一个list a, b, c, d,当入参为a, b, c, d, ea, 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

相关推荐
一次旅行20 小时前
【效率秘籍】Shell 函数+别名组合拳,让 80% 的重复命令变 1 个字母
大数据·elasticsearch·搜索引擎
暖和_白开水20 小时前
数据分析agent(九):es_client_manager.py 和分词器ik_max_word问题
elasticsearch·数据分析·c#
码农学院20 小时前
Elasticsearch构建汽车零配件智能搜索与匹配系统
大数据·elasticsearch·汽车
Elastic 中国社区官方博客2 天前
不到 5 分钟完成本地部署:Jina embedding 模型现已支持本地部署
大数据·人工智能·elasticsearch·搜索引擎·embedding·jina
二进制流水搬运工2 天前
入职第一天拉了23个仓库,我写了个脚本解放双手
大数据·elasticsearch·搜索引擎
Elasticsearch2 天前
在不到一小时内将 Datadog Kubernetes 仪表板迁移到 Elastic Observability
elasticsearch
.柒宇.2 天前
Elasticsearch 核心概念与系统架构详解
elasticsearch·系统架构
风行無痕2 天前
单机Elasticsearch 8.19.18安全升级到9.4.3的过程
大数据·elasticsearch·搜索引擎
Elastic 中国社区官方博客2 天前
使用重新设计的 AutoOps 更快地进行 Elasticsearch 问题排查
大数据·运维·前端·人工智能·elasticsearch·搜索引擎·全文检索
阿拉雷️2 天前
【搜索实战】Spring Boot 3.3 + AI Agent × Elasticsearch:让AI自动优化搜索策略,查询速度从2秒压到50毫秒
人工智能·spring boot·elasticsearch