简体   繁体   English

Grafana 变量:选择“全部”时返回所有 Elastic 文档,属性可能为空列表

[英]Grafana variable: Return all Elastic documents when selecting "All" and the attribute might be an empty list

Take the following Lucene query:采用以下 Lucene 查询:

provision_org.keyword:$provision_org

If $provision_org has the value "hello", the query returns all documents where provision_org (a list) contains the item "hello".如果$provision_org的值为“hello”,则查询返回provision_org (列表)包含项目“hello”的所有文档。 So far so good.到目前为止,一切都很好。

If $provision_org has the value "*", the query returns all documents where provision_org (a list) contains an element.如果$provision_org的值为“*”,则查询返回provision_org (列表)包含元素的所有文档。

Is there any value that I could assign to $provision_org so that all documents are returned, even those where provision_org is an empty list?是否有任何值可以分配给$provision_org以便返回所有文档,即使是那些provision_org是空列表的文档?

The reason I want this value is to set it as the "Custom All value" in the Grafana (multi-value) variable.我想要这个值的原因是将其设置为 Grafana(多值)变量中的“自定义所有值”。 Obviously what I want is to have an "All" option that effectively results in ignoring that particular variable.显然,我想要的是有一个“全部”选项,有效地导致忽略该特定变量。 (I'm not really certain that the "Custom All value" is the correct way to do that.) (我不确定“自定义所有值”是否是正确的方法。)

This might help:这可能会有所帮助:

* OR (NOT _exists_:provision_org.keyword)

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

Or you can use Ad hoc filter , but way to use it is quite different from variable或者您可以使用Ad hoc filter ,但使用方式与变量完全不同

在此处输入图像描述

在此处输入图像描述

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

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