Skip to content

Instantly share code, notes, and snippets.

@marcosvrrs
Last active January 13, 2021 11:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcosvrrs/6f4460c7d794f447f58e465c6dcbe42d to your computer and use it in GitHub Desktop.
Save marcosvrrs/6f4460c7d794f447f58e465c6dcbe42d to your computer and use it in GitHub Desktop.
The vega-lite code that I was trying to facet/small multiples
{
$schema: https://vega.github.io/schema/vega-lite/v4.json
title: Visu interessante
// Define the data source
data: {
url: {
/*
Kibana has a special handling for the fields surrounded by "%". They are processed before the the query is sent to Elasticsearch. This way the query becomes context aware, and can use the time range and the dashboard filters.
*/
// Apply dashboard context filters when set
%context%: true
// Filter the time picker (upper right corner) with this field
%timefield%: timestamp
index: index_do
body: {
aggs: {
sube: {
terms: {
field: "iName.keyword"
// "size": 10
}
aggs:{
transacoec: {
terms: {
field: "mo.keyword"
// size: 13
}
}
}
}
}
size: 0
}
}
format: {property: "aggregations.sube.buckets"}
}
// facet: { row: {field: "iName.keyword"}}
// spec: {
mark: bar
encoding: {
x: {
field: key
type: nominal
sort: -y
axis: {title: false} // Customize X axis format
}
y: {
field: doc_count
type: quantitative
axis: {title: "Quantidade de M"}
},
}
//}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment