我正在使用Kibana 7.1。

我已经成功创建了Vega线图。我可以允许它显示月份的数据,但是我希望用户在仪表板上使用时间过滤器,并允许vega可视化随之更改。

https://www.elastic.co/blog/getting-started-with-vega-visualizations-in-kibana和Vega文档中,我读到了插入

  "%context%": true,
  "%timefield%": "@timestamp"

内部URL将解决此问题,但是当我这样做时,它给了我url.%context% and url.%timefield% must not be used when url.body.query is set
我完整的elasticsearch代码如下所示:
  "data": {
    "url": {
      "%context%":"true",
      "index": "access_log",
      "body": {
        "query": {
          "bool": {
            "must": [
              {"term": {"request_1": "rent"}},
              {"term": {"status": 200}}
            ]
          }
        },
        "aggs": {
          "histo": {
            "date_histogram": {
              "field": "date",
              "interval": "day"
            },
            "aggs": {
              "start_agg": {
                "filter": {
                  "term": {"request_2": "start"}
                }
              },
              "check_agg": {
                "filter": {
                  "term": {"request_2": "check"}
                }
              },
              "start_check": {
                "bucket_script": {
                  "buckets_path": {
                    "start_count": "start_agg._count",
                    "check_count": "check_agg._count"
                  },
                  "script": "params.start_count / params.check_count"
                }
              }
            }
          }
        }
      }
    },
    "format": {
      "property": "aggregations.histo.buckets"
    }
  },
  "mark": {
    "type":"line"
  },
  "encoding": {
    "x": {
      "field": "key",
      "type": "temporal",
      "axis": {"title": false}
    },
    "y": {
      "field": "start_check.value",
      "type": "quantitative",
      "axis": {"title": "Document count"}
    },
    "tooltip":[
      {"field":"start_check.value",
       "type" : "quantitative"},
      {"field":"key",
       "type" :"temporal"}
    ]
  }
}

最佳答案

在日期是我的工作 Realm 之一的地方插入"%timefiled%":"date"

关于elasticsearch - 使用仪表板上的时间过滤器更改基巴纳州Vega的范围,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/58985935/

10-12 17:21