elatic查询所有中指定字段的唯一值
时间: 2023-12-10 11:39:44 浏览: 45
好的,我理解您的问题。您可以使用以下查询DSL来获取指定字段的唯一值:
```
GET your_index/_search
{
"size": 0,
"aggs": {
"NAME_OF_AGGREGATION": {
"terms": {
"field": "YOUR_FIELD"
}
}
}
}
```
请确保将上述查询中的 `your_index` 和 `YOUR_FIELD` 替换为您的实际索引名称和字段名称。这将返回该字段的所有唯一值。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![xlsx](https://img-home.csdnimg.cn/images/20210720083732.png)