Last active
February 22, 2018 21:23
-
-
Save nyurik/0383a898ed74882986ae2dd4cd6bee48 to your computer and use it in GitHub Desktop.
Vega Webinar - scatter plot showing web requests for various file types
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: { | |
// 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