Skip to content

Instantly share code, notes, and snippets.

@nyurik
Created February 22, 2018 21:24
Show Gist options
  • Save nyurik/c08f4e791a6ef0393b8aab72bbdb8d90 to your computer and use it in GitHub Desktop.
Save nyurik/c08f4e791a6ef0393b8aab72bbdb8d90 to your computer and use it in GitHub Desktop.
Vega Webinar - area chart from multivariable composite aggregation
{
$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