[英]Query templating in Grafana with Elasticsearch datasource
I have the values like Name:"Christopher; Johnson" , "Christopher; Nolan" etc. with the firstname and lastname seperated by a semicolon from the ES datasource. 我有类似Name的值:“ Christopher; Johnson”,“ Christopher; Nolan”等,其名字和姓氏由ES数据源中的分号分隔。 I'm trying to get these names in the variable template in Grafana.
我正在尝试在Grafana中的变量模板中获取这些名称。
The query I tried: 我试过的查询:
{"find":"terms", "field":"Name", "query":"Name:*Christopher*"}
and the error I got is "Only word and digit characters are allowed in variable names". 我得到的错误是“变量名中仅允许使用字母和数字字符”。 Doing
{"find":"terms", "field":"Name", "query":"Name:*Christopher* AND NOT Name:*;*"}
will filter out all the names having ";" 进行
{"find":"terms", "field":"Name", "query":"Name:*Christopher* AND NOT Name:*;*"}
将过滤出所有带有“;”的名称
Is there a way to get all these variables in a query template like: 有没有办法在查询模板中获取所有这些变量,例如:
irrespective of whether it is a firstname or a lastname. 不管它是名字还是姓氏。
Any help would be much appreciated. 任何帮助将非常感激。
I would write the query as {"find":"terms", "field":"Name"}
and then use the regex field below the query field to filter the names for the names you are looking for. 我将查询写为
{"find":"terms", "field":"Name"}
,然后使用查询字段下面的正则表达式字段来过滤您要查找的名称的名称。
To find Christopher you could do something like /.*[Christopher].*/
要找到Christopher,您可以执行
/.*[Christopher].*/
Here is an example of a query that finds only clientCDIRs that have A2 in them: 这是一个查询示例,该查询仅查找其中具有A2的clientCDIR:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.