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

相关推荐
Elasticsearch2 分钟前
教程:使用 ES|QL 进行威胁狩猎
elasticsearch
智搜广告2 小时前
GEO优化公司怎么选?智搜广告从三个维度帮你判断
大数据·人工智能·python·elasticsearch·microsoft·geo
Elastic 中国社区官方博客2 小时前
Elasticsearch:ES|QL 搜索教程
大数据·数据库·人工智能·sql·elasticsearch·搜索引擎·全文检索
Elasticsearch4 小时前
Elasticsearch 中的查询重写规则:通配符扫描速度提升 2.3 倍
elasticsearch
Elasticsearch4 小时前
隐藏在可观测性数据中的安全攻击
elasticsearch
Elasticsearch18 小时前
Elasticsearch:ES|QL 搜索教程
elasticsearch
玖石书1 天前
Git Submodule 完全指南:从添加到日常维护的常规操作全流程
大数据·git·elasticsearch
晴天161 天前
ES 标准、V8 引擎与 Node.js 版本联动关系全解与实战踩坑
大数据·elasticsearch·node.js
考虑考虑2 天前
ElasticSearch索引命令
运维·后端·elasticsearch
Elastic 中国社区官方博客2 天前
在 Elasticsearch 中回填时间序列数据:通过批量 API 加载数月的历史指标数据
大数据·运维·数据库·人工智能·elasticsearch·搜索引擎·全文检索