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

相关推荐
阿里云大数据AI技术18 小时前
千亿级 AI 搜索的效能实战:从混合检索到 Agentic RAG 的三年实战
人工智能·elasticsearch·阿里云·agentic·ai 搜索
techdashen19 小时前
Cloudflare Agents Week 2026 总结:20 项发布,一张 Cloud 2.0 的完整地图
大数据·elasticsearch·搜索引擎
callJJ20 小时前
Git 分支合并到测试分支(dep-qa)教程
大数据·git·elasticsearch
yulingfeng5920 小时前
Elasticsearch 分词器安装(IK+拼音)
大数据·elasticsearch·jenkins
Elastic 中国社区官方博客20 小时前
从平均值到任意百分位数:Elasticsearch 在 ES|QL 中原生支持指数直方图
大数据·数据库·sql·elasticsearch·搜索引擎·全文检索·prometheus
OYangxf1 天前
Git分支管理
大数据·git·elasticsearch
Elastic 中国社区官方博客1 天前
在 Elasticsearch 中使用原生 PromQL 支持查询 Prometheus 指标
大数据·elasticsearch·搜索引擎·信息可视化·全文检索·prometheus
喜欢流萤吖~1 天前
Elasticsearch集群:高可用与水平扩展的基石
大数据·elasticsearch·搜索引擎
Elastic 中国社区官方博客1 天前
Elastic 9.4:Workflows 正式发布、Agent Builder 更新,以及 Prometheus / PromQL 支持
运维·数据库·人工智能·elasticsearch·搜索引擎·信息可视化·prometheus
逸Y 仙X1 天前
Elasticsearch时间类型实战
java·大数据·elasticsearch·搜索引擎·全文检索