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 小时前
14 个 alerts,1 个 incident:使用 Elasticsearch 中的 ES|QL 衡量 alerting rule 噪声
大数据·运维·数据库·elasticsearch·搜索引擎·全文检索
SelectDB技术团队14 小时前
一条日志两套引擎的账:把 Elasticsearch 检索与分析合并到同一份数据的落地写法
大数据·数据库·elasticsearch·搜索引擎·全文检索·日志·apache doris
Elastic 中国社区官方博客1 天前
使用 Lucene 搜索你的 Bean —— Elasticsearch
大数据·开发语言·人工智能·elasticsearch·搜索引擎·全文检索·lucene
闲蛋小超人笑嘻嘻1 天前
Git Worktree 详解
大数据·elasticsearch·搜索引擎
MayBaymax1 天前
Elasticsearch 原理与用法
java·elasticsearch
IT大白鼠1 天前
搜索系列 · 第 01 篇——认知入门:Elasticsearch 是什么
elasticsearch·nosql
Elasticsearch1 天前
14 个 alerts,1 个 incident:使用 Elasticsearch 中的 ES|QL 衡量 alerting rule 噪声
elasticsearch
Elasticsearch1 天前
Kubernetes attributes processor v1:它对 EDOT Collector 意味着什么
elasticsearch
Elasticsearch1 天前
Elasticsearch Serverless 如何通过 hollow shards 将索引节点关闭次数降低 30%
elasticsearch
SelectDB技术团队1 天前
Agent Trace 数据底座建设:宽表建模、全文检索与成本聚合的配置与验证步骤
大数据·python·clickhouse·elk·elasticsearch·全文检索·复杂查询