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 中国社区官方博客39 分钟前
Elasticsearch:使用预计算上下文降低 agent 成本
大数据·人工智能·elasticsearch·搜索引擎·ai·全文检索
SLD_Allen1 小时前
企业级 AI Agent: MCP、CLI、Skills,如何定位、该怎么选、最佳实践。
大数据·人工智能·elasticsearch·企业级 ai agent
幻灭行度3 小时前
Elasticsearch 索引备份与恢复实践(基于 NFS 共享仓库)
elasticsearch
做个文艺程序员4 小时前
第09篇:ES 数据同步方案——Canal + Logstash + Flink 全方案对比与实战
大数据·elasticsearch·mysql同步es·es数据同步·flink实时同步·es增量同步
做个文艺程序员4 小时前
第04篇:Query DSL 全景与高级检索实战——从入门查询到复杂业务场景
elasticsearch·elasticsearch分词·elasticsearch检索
杰克尼13 小时前
天机学堂复习总结(day03-day04)
java·开发语言·redis·elasticsearch·spring cloud
一勺菠萝丶1 天前
Git Tag 使用教程:如何打 Tag、切换 Tag、推送 Tag 和删除 Tag
大数据·git·elasticsearch
Elastic 中国社区官方博客1 天前
Kibana 中的 AI Chat 现在可以原生渲染仪表板
大数据·数据库·人工智能·elasticsearch·搜索引擎·云原生
Elastic 中国社区官方博客1 天前
Elastic 的 ML 与 AI Assistant 如何将 NOC 中 802.1x 故障排查时间从 20 分钟缩短到数秒
大数据·运维·人工智能·elasticsearch·搜索引擎·全文检索·可用性测试
Gavin-Wang1 天前
swift 项目 commit 规范
大数据·elasticsearch·搜索引擎