简体   繁体   English

使用Grafana中的模板并以Elasticsearch作为数据源的术语聚合

[英]Term aggregation using template in Grafana with Elasticsearch as data source

I have a doc in Elasticsearch with different fieldnames, eg: a,b,c,d... 我在Elasticsearch中有一个文档,具有不同的字段名,例如:a,b,c,d ...

I want to use templating in Grafana to query a term aggregation in such way that I get the values in a field. 我想在Grafana中使用模板查询术语聚合,这样我就可以在字段中获取值。 eg: i. 例如:i。

I'm trying to use this query: 我正在尝试使用以下查询:

{"find":"terms","field":"i","size":25}

but it does not return any values. 但它不返回任何值。

I know that there are some values as I query the same docs with Sense. 我知道有一些值,因为我使用Sense查询相同的文档。

I have Grafana v 4.6.2 and Elasticsearch v 2.3.4 我有Grafana v 4.6.2和Elasticsearch v 2.3.4

The field I wanted has a "-" in the string. 我想要的字段在字符串中有一个“-”。 ES sees it as a separator, this was the reason of the error. ES将其视为分隔符,这是导致错误的原因。

Changing the field's mapping to "not analyzed" should help. 将字段的映射更改为“未分析”应该会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM