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

相关推荐
serve the people2 小时前
Elasticsearch(5) i want to monitor the es health from a http api
大数据·http·elasticsearch
Taerge01105 小时前
Doris, StarRocks, ClickHouse, Hologres, ES 对比,选型建议
大数据·clickhouse·elasticsearch
serve the people15 小时前
Elasticsearch(1) could you tell me how to use es if i am a beginner
大数据·elasticsearch·jenkins
一个儒雅随和的男子16 小时前
Elasticsearch出现深度分页问题怎么解决?
大数据·elasticsearch·搜索引擎
serve the people1 天前
Elasticsearch(3) show me some examples
大数据·elasticsearch·jenkins
是一个Bug1 天前
Elasticsearch 保姆级入门:从“找文件”到“秒级搜索”
大数据·elasticsearch·搜索引擎
serve the people1 天前
Elasticsearch(4) show me some more advanced content
大数据·elasticsearch·jenkins
fangdengfu1232 天前
ES分析系统各个服务日志占用量
java·前端·elasticsearch
兄台の请冷静2 天前
Linux 安装es
linux·elasticsearch·jenkins
java_cj2 天前
Elasticsearch索引管理完全指南:从基础API到ILM生命周期管理
大数据·后端·elasticsearch·性能优化