如何在grafana中创建非基于时间的表?

时间:2019-06-29 19:43:35

标签: elasticsearch text grafana dashboard

我喜欢根据Elasticsearch索引在Grafana中创建一个表。下面显示了一个索引片段:

{
    "took" : 3,
    "timed_out" : false,
    "_shards" : {
        "total" : 1,
        "successful" : 1,
        "skipped" : 0,
        "failed" : 0
   },
   "hits" : {
   "total" : {
       "value" : 9,
       "relation" : "eq"
   },
   "max_score" : 1.0,
   "hits" : [
       {
           "_index" : "ix",
           "_type" : "_doc",
           "_id" : "1",
           "_score" : 1.0,
           "_source" : {
             "entityName" : "ent1",
             "scenario" : "development1",
             "timestamp" : "2019-06-28T23:14:29.640577",
             "impactType" : "imp",
             "mean" : 0.4,
             "lower3s" : 0.32000000000000006,
             "upper3s" : 0.48
          }
       },
       {
            "_index" : "ix",
            "_type" : "_doc",
            "_id" : "2",
            "_score" : 1.0,
            "_source" : {
              "entityName" : "ent2",
              "scenario" : "development1",
              "timestamp" : "2019-06-28T23:14:29.640577",
              "impactType" : "imp",
              "mean" : 0.4,
              "lower3s" : 0.32000000000000006,
              "upper3s" : 0.48
            }
       },

我想从该索引创建一个表,该表列出entityName作为索引,例如mean作为值。时间戳与此处无关。看起来应该像这样:

| entityName | mean |
| ent1       | 0.4  |
| ent2       | 0.4  |

,依此类推。 我尝试了几个仪表板面板,广泛地使用了桌面面板,但是却一无所获。我认为在Grafana游乐场中,最接近的示例是https://play.grafana.org/d/000000031/table-panel-showcase?tab=queries&orgId=1&fullscreen&edit&panelId=1。但是,该示例中使用的查询并非来自Elasticsearch作为数据源,因此我不知道如何将其转换为ES。有谁能帮忙吗?谢谢!

0 个答案:

没有答案