mark
from line
to point
, area
, bar
, circle
, square
, ... (see documentation )."url": "data/world-110m.json"
with the "url": "https://vega.imtqy.com/editor/data/world-110m.json"
(see note below)."url"
parameter. Kibana adds support for direct Elasticsearch requests by resetting the "url"
value.
@timestamp
field to filter the time range and split it into histogram segments.
// An object instead of a string for the url value // is treated as a context-aware Elasticsearch query. url: { // Filter the time picker (upper right corner) with this field %timefield%: @timestamp // Apply dashboard context filters when set %context%: true // Which indexes to search index: _all // The body element may contain "aggs" and "query" subfields body: { aggs: { time_buckets: { date_histogram: { // Use date histogram aggregation on @timestamp field field: @timestamp // interval value will depend on the daterange picker // Use an integer to set approximate bucket count interval: { %autointerval%: true } // Make sure we get an entire range, even if it has no data extended_bounds: { min: { %timefilter%: "min" } max: { %timefilter%: "max" } } // Use this for linear (eg line, area) graphs // Without it, empty buckets will not show up min_doc_count: 0 } } } // Speed up the response by only including aggregation results size: 0 } }
{ "aggregations": { "time_buckets": { "buckets": [{ "key_as_string": "2015-11-30T22:00:00.000Z", "key": 1448920800000, "doc_count": 28 }, { "key_as_string": "2015-11-30T23:00:00.000Z", "key": 1448924400000, "doc_count": 330 }, ...
"key"
is a Unix timestamp and can be used without transformations by Vega date expressions.
format: {property: "aggregations.time_buckets.buckets"}
to focus only on the data we need.
"%context%": true, "%timefield%": "@timestamp"
, except for shifting the time range 10 minutes ago.
{ body: { query: { bool: { must: [ // This string will be replaced // with the auto-generated "MUST" clause "%dashboard_context-must_clause%" { range: { // apply timefilter (upper right corner) // to the @timestamp variable @timestamp: { // "%timefilter%" will be replaced with // the current values of the time filter // (from the upper right corner) "%timefilter%": true // Only work with %timefilter% // Shift current timefilter by 10 units back shift: 10 // week, day (default), hour, minute, second unit: minute } } } ] must_not: [ // This string will be replaced with // the auto-generated "MUST-NOT" clause "%dashboard_context-must_not_clause%" ] } } } }
"%timefilter%"
can also be used to determine one minimum or maximum value. As shown above, the extended_bounds
in date_histogram can be set with two values ​​— minimum and maximum. Instead of hard-coding the value, you can use "min": {"%timefilter%": "min"}
, which will be overwritten at the beginning of the current time range. The shift
and unit
values ​​are also supported. "Interval" can be set dynamically, depending on the currently selected range: "interval": {"%autointerval%": 10}
will try to get about 10-15 data points (segments).
url: { // "type" defaults to "elasticsearch" otherwise type: emsfile // Name of the file, exactly as in the Region map visualization name: World Countries } // The result is a geojson file, get its features to use // this data source with the "shape" marks // https://vega.imtqy.com/vega/docs/marks/shape/ format: {property: "features"}
type=map
in the host configuration.
{ "config": { "kibana": { "type": "map", // Initial map position "latitude": 40.7, // default 0 "longitude": -74, // default 0 "zoom": 7, // default 2 // defaults to "default". Use false to disable base layer. "mapStyle": false, // default 0 "minZoom": 5, // defaults to the maximum for the given style, // or 25 when base is disabled "maxZoom": 13, // defaults to true, shows +/- buttons to zoom in/out "zoomControl": false, // defaults to true, disables mouse wheel zoom "scrollWheelZoom": false, // When false, repaints on each move frame. // Makes the graph slower when moving the map "delayRepaint": true, // default true } }, /* the rest of Vega JSON */ }
"projection"
. Use this to calculate the position of all geo-oriented labels. Additionally, you can use longitude, latitude and scaling. These signals can be used in the graph or can be updated to change the positioning of the map.
VEGA_DEBUG
: * view
- access to the View object Vega. See the Vega Debugging Guide for how to inspect data and signals at runtime. For VegaLite, VEGA_DEBUG.view.data('source_0')
gets the main data set. For Vega, it uses the data name, which is specifically in your Vega specification. * vega_spec
specification of the Vega JSON graph after some modifications from Kibana. In the case of VegaLite, this is the output of the VegaLite compiler. * vegalite_spec
- if this is a VegaLite graph, a JSON graph specification before compiling VegaLite
GET <INDEX_NAME>/_search
, and add your query in the next line (just the value of the "query"
field).
vega.enableExternalUrls: false
to the kibana.yml file.
"url": "data/world-110m.json"
with "url": "https://vega.imtqy.com/editor/data/world-110m.json"
. Also in regular examples, Vega uses the "autosize": "pad"
layout model "autosize": "pad"
, and Kibana uses fit
. Remove all autosize
, width
and height
values. See below for dimensions and positioning.
{ config: { kibana: { // Placement of the Vega-defined signal bindings. // Can be `left`, `right`, `top`, or `bottom` (default). controlsLocation: top // Can be `vertical` or `horizontal` (default). controlsDirection: vertical // If true, hides most of Vega and VegaLite warnings hideWarnings: true // Vega renderer to use: `svg` or `canvas` (default) renderer: canvas } } /* the rest of Vega code */ }
autosize = { type: 'fit', contains: 'padding' }
layout model for Vega and VegaLite graphs. The fit
model uses all available space, ignoring the width
and height
values, but takes into account the indent values. You can override this behavior by specifying a different autosize
value.
autosize
, width
, height
and padding
values ​​using the zero indent fit
model.
Source: https://habr.com/ru/post/442278/