Created
February 22, 2018 21:24
-
-
Save nyurik/c08f4e791a6ef0393b8aab72bbdb8d90 to your computer and use it in GitHub Desktop.
Vega Webinar - area chart from multivariable composite aggregation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
$schema: https://vega.github.io/schema/vega-lite/v2.json | |
data: { | |
url: { | |
index: logstash-* | |
%context%: true | |
%timefield%: @timestamp | |
body: { | |
size: 0 | |
aggs: { | |
table: { | |
composite: { | |
size: 10000 | |
sources: [ | |
{ | |
time: { | |
date_histogram: { | |
field: @timestamp | |
interval: {%autointerval%: 500} | |
} | |
} | |
} | |
{ | |
ext: { | |
terms: {field: "extension.raw"} | |
} | |
} | |
] | |
} | |
} | |
} | |
} | |
} | |
format: {property: "aggregations.table.buckets"} | |
} | |
transform: [ | |
{calculate: "datum.key.time", as: "time"} | |
{calculate: "datum.key.ext", as: "ext"} | |
] | |
mark: area | |
encoding: { | |
x: { | |
field: time | |
type: temporal | |
axis: {title: null} | |
} | |
y: { | |
axis: {title: "Document count"} | |
field: doc_count | |
type: quantitative | |
} | |
color: {field: "ext", type: "nominal"} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment