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 中国社区官方博客2 小时前
Elasticsearch 日志写入提速:用 3 项设置和 logsdb_columnar 从每秒 5.2 万行提升到 11.2 万行
大数据·开发语言·elasticsearch·搜索引擎·全文检索
岳涛_daemon4 小时前
向量|文本本来就不该切,ES 9.1 之前推理端点只会自动分块,none 让整段作为一个整体嵌入
elasticsearch
岳涛5 小时前
时序|ES 9.3 把 T-Digest 存成字段,子集分位数推不出总体,它的摘要却能合并
elasticsearch
Elasticsearch6 小时前
只需一段 YAML 配置,即可将每个 OpenTelemetry Collector 接入 Fleet
elasticsearch
Elasticsearch1 天前
从 137,306 行日志定位到一个故障副本:在 Kibana 中排查错误激增
elasticsearch
Elasticsearch1 天前
State 即将弃用,由 cpu.mode 接替:在 Elastic 中迁移 OpenTelemetry 进程指标
elasticsearch
岳涛1 天前
考古|ES 5.3 三条改动只提前打招呼,布尔宽松写法到 6.0 才真正拒绝
elasticsearch
Elasticsearch1 天前
谁在发起请求?为 Amazon Bedrock AgentCore 智能体配置按用户划分的 Elasticsearch 访问权限
elasticsearch