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

相关推荐
星光一影5 小时前
基于SpringBoot智慧社区系统/乡村振兴系统/大数据与人工智能平台
大数据·spring boot·后端·mysql·elasticsearch·vue
Elasticsearch1 天前
在 Kibana 中引入 Elasticsearch 查询规则界面
elasticsearch
Elastic 中国社区官方博客1 天前
使用 Mastra 和 Elasticsearch 构建具有语义回忆功能的知识 agent
大数据·数据库·人工智能·elasticsearch·搜索引擎·ai·全文检索
新手小白*1 天前
Elasticsearch+Logstash+Filebeat+Kibana部署【7.1.1版本】
大数据·elasticsearch·搜索引擎
lpfasd1232 天前
git-团队协作基础
chrome·git·elasticsearch
苗壮.2 天前
「个人 Gitee 仓库」与「企业 Gitee 仓库」同步的几种常见方式
大数据·elasticsearch·gitee
Elastic 中国社区官方博客2 天前
如何使用 Ollama 在本地设置和运行 GPT-OSS
人工智能·gpt·elasticsearch·搜索引擎·ai·语言模型
Elasticsearch2 天前
Elastic Streams 中的数据协调:稳健架构深度解析
elasticsearch
Elasticsearch2 天前
使用 Instrumentation Score 和 Elastic 的 OpenTelemetry 数据质量洞察
elasticsearch
青鱼入云2 天前
ES索引配置字段解读
大数据·elasticsearch·搜索引擎