vega lite/kibana管理url对象的差异

piok6c0g  于 2021-06-13  发布在  ElasticSearch
关注(0)|答案(1)|浏览(333)

我发现了一篇有趣的文章,在vega-lite上使用了几个数据模型。在关系数据库中,表格数据是通过类键组合的。

{
    "$schema": "https://vega.github.io/schema/vega-lite/v2.json",
    "title": "Test",
    "datasets": {
        "stores": [
        {"cmdb_id1": 1, "group": "type1"},
        {"cmdb_id1": 2, "group": "type1"},
        {"cmdb_id1": 3, "group": "type2"}
        ],
        "labelsTimelines": [
        {"cmdb_id2": 1, "value": 83},
        {"cmdb_id2": 2, "value": 53},
        {"cmdb_id2": 3, "value": 23}
        ]
    },
    "data": {"name": "stores"},
    "transform": [
        {
        "lookup": "cmdb_id1",
        "from": {
            "data": {"name": "labelsTimelines"},
            "key": "cmdb_id2",
            "fields": ["value"]
        }
        }
    ],
    "mark": "bar",
    "encoding": {
        "y": {"aggregate": "sum", "field": "value", "type": "quantitative"},
        "x": {"field": "group", "type": "ordinal"}
    }
}

织女星编辑
由此产生的问题是,使用这种结构是否可能获得同样的结果:
“data”:{“url”:“…”}
已更改elasticsearch查询的源:

{
    "$schema": "https://vega.github.io/schema/vega-lite/v3.json",

    "datasets": {
        "stores": [{
        "url": {
        "%context%": "true"
        "index": "test_cmdb"
        "body": {
            "size": 1000,
            "_source": ["cmdb_id", "street","group"]
        }
        }
        format: {property: "hits.hits"}
    }]}

    "data": {
        "name": "stores"
    },

    "encoding": {
        "x": {"field": "url.body.size", "type": "ordinal", "title": "X"},
        "y": {"field": "url.body.size", "type": "ordinal", "title": "Y"}
    },
    "layer": [
        {
        "mark": "rect",

        "encoding": {
            "tooltip": [
            {"field": "url"}]
        }
        }

    ]
}

我了解到有一个语法错误,数据不是来自elasticsearch。
提前谢谢!
示例.png

4nkexdtk

4nkexdtk1#

不,当前无法在顶层中指定url数据 "datasets" . vega lite中的相关开放功能请求如下:https://github.com/vega/vega-lite/issues/4004.

相关问题