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

相关推荐
Elasticsearch10 小时前
Elasticsearch:使用 AI Agent 来创建 workflows
elasticsearch
gll77313 小时前
RAG 检索层实战:Redis 缓存 + ES 混合检索 + BGE-Rerank 重排全链路落地与踩坑
elasticsearch
Elasticsearch14 小时前
ES 存日志很贵?我用 ES 9.5 把日志从 4.5G 压到 412M 压缩比11.2倍,日志硬扫每秒128万行!
elasticsearch
Elasticsearch17 小时前
Elasticsearch 作为统一平台:引入第二套数据系统究竟要付出什么代价
elasticsearch
Elastic 中国社区官方博客17 小时前
Elasticsearch:列式索引模式 - Columnar index mode
大数据·数据库·elasticsearch·搜索引擎·全文检索
Elasticsearch17 小时前
Elasticsearch 的批量查询阶段如何在大规模场景下提升搜索性能
elasticsearch
Ramboooooooo19 小时前
SkyWalking-10.4.0 Docker + Nacos + Elasticsearch 生产级部署手册
elasticsearch·docker·skywalking
互联网中的一颗神经元1 天前
04 — 安全撤销:改错了怎么退回去
大数据·安全·elasticsearch
Elasticsearch1 天前
Elasticsearch:列式索引模式 - Columnar index mode
elasticsearch
Elasticsearch2 天前
从 CrashLoopBackOff 到根本原因,只需几秒:使用 Elastic Observability 自动化 20 分钟的 Kubernetes 调查流
elasticsearch