Я пытаюсь загрузить данные изasticsearch в vega-lite для построения линейного графика. Однако я продолжаю сталкиваться с датумом. Источник не определена, когда я пытаюсь построить. Я не понимаю, где я иду не так. Я сделал код, очень похожий на примеры, приведенные в документации
мои данные вasticsearch выглядят как
{
"_index" : "processed_atiasample",
"_type" : "_doc",
"_id" : "Lerdg20BsIsU9VdP1GAd",
"_score" : 1.0,
"_source" : {
"@timestamp" : "2017-08-26T05:55:42.600Z"
}
},
{
"_index" : "processed_atiasample",
"_type" : "_doc",
"_id" : "rOrdg20BsIsU9VdP01-u",
"_score" : 1.0,
"_source" : {
"analytics" : {
"siteActIdCtList" : {
"Incoming_siteId" : 14,
"Incoming_actIdCt" : 176
}
},
"@timestamp" : "2017-08-26T05:55:46.000Z"
}
}
my code is -
{
$schema: https://vega.github.io/schema/vega-lite/v2.json
title: Active users in Sites over Time
// Define the data source
data: {
url: {
// Apply dashboard context filters when set
%context%: true
// Filter the time picker (upper right corner) with this field
%timefield%: @timestamp
// Which index to search
index: processed_atiasample
body: {
_source: [
"@timestamp",
"analytics.siteActIdCtList.Incoming_siteId",
"analytics.siteActIdCtList.Incoming_actIdCt"
]
}
format: {property: "hits.hits"}
}
}
transform: [
{calculate: "toDate(datum._source['@timestamp'])", as: "time"}
]
mark: line
encoding: {
x: {field: "time", type: "temporal"}
y: {
field: _source.analytics.siteActIdCtList.Incoming_actIdCt
type: quantitative
}
color: {field: "_source.analytics.siteActIdCtList.Incoming_siteId", type: "nominal"}
}
}
мой код -
{
$schema: https://vega.github.io/schema/vega-lite/v2.json
title: Active users in Sites over Time
// Define the data source
data: {
url: {
// Apply dashboard context filters when set
%context%: true
// Filter the time picker (upper right corner) with this field
%timefield%: @timestamp
// Which index to search
index: processed_atiasample
body: {
_source: [
"@timestamp",
"analytics.siteActIdCtList.Incoming_siteId",
"analytics.siteActIdCtList.Incoming_actIdCt"
]
}
format: {property: "hits.hits"}
}
}
transform: [
{calculate: "toDate(datum._source['@timestamp'])", as: "time"}
]
mark: line
encoding: {
x: {field: "time", type: "temporal"}
y: {
field: _source.analytics.siteActIdCtList.Incoming_actIdCt
type: quantitative
}
color: {field: "_source.analytics.siteActIdCtList.Incoming_siteId", type: "nominal"}
}
}