Skip to content

Instantly share code, notes, and snippets.

@nyurik
Last active February 22, 2018 21:23
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 nyurik/0383a898ed74882986ae2dd4cd6bee48 to your computer and use it in GitHub Desktop.
Save nyurik/0383a898ed74882986ae2dd4cd6bee48 to your computer and use it in GitHub Desktop.
Vega Webinar - scatter plot showing web requests for various file types
{
$schema: https://vega.github.io/schema/vega-lite/v2.json
data: {
// Get 10000 documents from ES
url: {
%context%: true
%timefield%: @timestamp
index: logstash-*
body: {
size: 10000
_source: ["@timestamp", "extension"]
}
}
format: {property: "hits.hits"}
}
// Parse timestamp and copy extension into new variables
transform: [
{calculate: "toDate(datum._source['@timestamp'])", as: "time"}
{calculate: "datum._source.extension", as: "ext"}
]
// Draw results as colored circles
mark: circle
encoding: {
x: {
field: time
type: temporal
axis: {title: null, labelAngle: 30}
}
y: {
field: ext
type: nominal
axis: {title: null}
}
color: {field: "ext", type: "nominal"}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment