2019-04-01 17:32:11 +02:00
[role="xpack"]
2019-03-11 23:40:22 +01:00
[[maps-getting-started]]
2019-09-06 04:45:23 +02:00
== Getting started with Elastic Maps
2019-03-11 23:40:22 +01:00
2019-09-06 04:45:23 +02:00
You work with *Elastic Maps* by adding layers. The data for a layer can come from
2019-05-10 21:49:07 +02:00
sources such as {es} documents, vector sources, tile map services, web map
services, and more. You can symbolize the data in different ways.
For example, you might show which airports have the longest flight
delays by using circles from small to big. Or,
you might show the amount of web log traffic by shading countries from
light to dark.
2019-03-11 23:40:22 +01:00
[role="screenshot"]
image::maps/images/sample_data_web_logs.png[]
2019-08-03 00:52:08 +02:00
[[maps-read-only-access]]
2019-09-06 04:45:23 +02:00
NOTE: If you have insufficient privileges to create or save maps, a read-only icon
2019-08-03 00:52:08 +02:00
appears in the application header. The buttons to create new maps or edit
existing maps won't be visible. For more information on granting access to
Kibana see <<xpack-security-authorization>>.
[role="screenshot"]
image::maps/images/read-only-badge.png[Example of Maps' read only access indicator in Kibana's header]
2019-03-11 23:40:22 +01:00
[float]
=== Prerequisites
Before you start this tutorial, <<add-sample-data, add the web logs sample data set>>. Each
2019-09-06 04:45:23 +02:00
sample data set includes a map to go along with the data. Once you've added the data, open *Elastic Maps* and
2019-03-11 23:40:22 +01:00
explore the different layers of the *[Logs] Total Requests and Bytes* map.
You'll re-create this map in this tutorial.
[float]
=== Take-away skills
In this tutorial, you'll learn to:
* Create a multi-layer map
* Connect a layer to a data source
* Use symbols, colors, and labels to style a layer
* Create layers for {es} data
2019-04-01 17:32:11 +02:00
[role="xpack"]
[[maps-create]]
2019-03-11 23:40:22 +01:00
=== Creating a new map
The first thing to do is to create a new map.
2019-09-06 04:45:23 +02:00
. If you haven't already, open *Elastic Maps*.
2019-03-11 23:40:22 +01:00
. On the maps list page, click *Create map*.
2019-05-10 21:49:07 +02:00
. Set the time range to *Last 7 days*.
2019-03-11 23:40:22 +01:00
+
A new map is created using a base tile layer.
+
[role="screenshot"]
image::maps/images/gs_create_new_map.png[]
2019-04-01 17:32:11 +02:00
[role="xpack"]
[[maps-add-choropleth-layer]]
2019-03-11 23:40:22 +01:00
=== Adding a choropleth layer
Now that you have a map, you'll want to add layers to it.
2019-05-10 21:49:07 +02:00
The first layer you'll add is a choropleth layer to shade world countries
by web log traffic. Darker shades symbolize countries with more web log traffic,
2019-03-11 23:40:22 +01:00
and lighter shades symbolize countries with less traffic.
2020-05-12 18:28:52 +02:00
==== Add a vector layer to display world country boundaries
2019-03-11 23:40:22 +01:00
2020-05-12 18:28:52 +02:00
. Click *Add layer*.
. Select the *EMS Boundaries* layer.
2019-03-11 23:40:22 +01:00
. From the *Layer* dropdown menu, select *World Countries*.
. Click the *Add layer* button.
2020-01-15 23:08:33 +01:00
. Set *Name* to `Total Requests by Country`.
. Set *Opacity* to 50%.
. Click *Add* under *Tooltip fields*.
. In the popover, select *ISO 3166-1 alpha-2 code* and *name* and click *Add*.
2019-03-11 23:40:22 +01:00
===== Join the vector layer with the sample web log index
2019-05-10 21:49:07 +02:00
You now have a vector layer containing the world countries.
To symbolize countries by web traffic, you'll need to augment the world country features with the count of Elasticsearch weblog documents originating from each country.
2020-01-15 23:08:33 +01:00
To do this, you'll create a <<terms-join, term join>> to link the vector source *World Countries* to
2019-05-10 21:49:07 +02:00
the {es} index `kibana_sample_data_logs` on the shared key iso2 = geo.src.
2019-03-11 23:40:22 +01:00
2020-04-09 19:42:30 +02:00
. Click plus image:maps/images/gs_plus_icon.png[] next to the *Term Joins* label.
2019-03-11 23:40:22 +01:00
. Click *Join --select--*
. Set *Left field* to *ISO 3166-1 alpha-2 code*.
. Set *Right source* to *kibana_sample_data_logs*.
. Set *Right field* to *geo.src*.
2020-01-15 23:08:33 +01:00
. Click *and use metric count*.
. Set *Custom label* to *web logs count*.
2019-03-11 23:40:22 +01:00
2019-11-11 23:34:45 +01:00
===== Set the layer style
2019-03-11 23:40:22 +01:00
2019-05-10 21:49:07 +02:00
All of the world countries are still a single color because the layer is using <<maps-vector-style-static, static styling>>.
To shade the world countries based on which country is sending the most requests, you'll need to use <<maps-vector-style-data-driven, data driven styling>>.
2019-03-11 23:40:22 +01:00
2020-01-15 23:08:33 +01:00
. Under *Fill color*, change the selected value from *Solid* to *By value*.
. In the field select input, select *web logs count*.
2019-03-11 23:40:22 +01:00
. Select the grey color ramp.
2020-01-15 23:08:33 +01:00
. Under *Border color*, change the selected color to *white*.
2019-03-11 23:40:22 +01:00
. Click *Save & close*.
+
Your map now looks like this:
+
[role="screenshot"]
image::maps/images/gs_add_cloropeth_layer.png[]
2019-04-01 17:32:11 +02:00
[role="xpack"]
[[maps-add-elasticsearch-layer]]
2019-03-11 23:40:22 +01:00
=== Adding layers for {es} data
2019-05-10 21:49:07 +02:00
To avoid overwhelming the user with too much data at once, you'll add two layers for {es} data.
* The first layer will display individual documents.
The layer will appear when the user zooms in the map to show smaller regions.
2020-05-12 18:28:52 +02:00
* The second layer will display aggregated data that represents many documents.
2019-05-10 21:49:07 +02:00
The layer will appear when the user zooms out the map to show larger amounts of the globe.
2019-03-11 23:40:22 +01:00
2020-05-12 18:28:52 +02:00
==== Add a vector layer to display individual documents
2019-03-11 23:40:22 +01:00
This layer displays web log documents as points.
2019-05-10 21:49:07 +02:00
The layer is only visible when users zoom in the map past zoom level 9.
2019-03-11 23:40:22 +01:00
2020-05-12 18:28:52 +02:00
. Click *Add layer*.
. Click the *Documents* layer.
2019-03-11 23:40:22 +01:00
. Set *Index pattern* to *kibana_sample_data_logs*.
. Click the *Add layer* button.
2020-01-15 23:08:33 +01:00
. Set *Name* to `Actual Requests`.
. Set *Visibilty* to the range [9, 24].
. Set *Opacity* to 100%.
. Click *Add* under *Tooltip fields*.
. In the popover, select *clientip*, *timestamp*, *host*, *request*, *response*, *machine.os*, *agent*, and *bytes* and click *Add*.
2019-03-11 23:40:22 +01:00
. Set *Fill color* to *#2200ff*.
. Click *Save & close*.
2019-05-10 21:49:07 +02:00
+
Your map now looks like this between zoom levels 9 and 24:
+
[role="screenshot"]
image::maps/images/gs_add_es_document_layer.png[]
2019-03-11 23:40:22 +01:00
2020-05-12 18:28:52 +02:00
==== Add a vector layer to display aggregated data
2019-03-11 23:40:22 +01:00
2019-05-10 21:49:07 +02:00
Aggregations group {es} documents into grids. You can calculate metrics
for each gridded cell.
2019-03-11 23:40:22 +01:00
2019-05-10 21:49:07 +02:00
You'll create a layer for aggregated data and make it visible only when the map
is zoomed out past zoom level 9. Darker colors will symbolize grids
with more web log traffic, and lighter colors will symbolize grids with less
traffic. Larger circles will symbolize grids with
more total bytes transferred, and smaller circles will symbolize
2019-03-11 23:40:22 +01:00
grids with less bytes transferred.
[role="screenshot"]
image::maps/images/grid_metrics_both.png[]
===== Add the layer
2020-05-12 18:28:52 +02:00
. Click *Add layer*.
. Click the *Clusters and grids* layer.
2019-03-11 23:40:22 +01:00
. Set *Index pattern* to *kibana_sample_data_logs*.
. Click the *Add layer* button.
2020-01-15 23:08:33 +01:00
. Set *Name* to `Total Requests and Bytes`.
. Set *Visibility* to the range [0, 9].
. Set *Opacity* to 100%.
2019-03-11 23:40:22 +01:00
===== Configure the aggregation metrics
2020-01-15 23:08:33 +01:00
. Click *Add metric* under of *Metrics* label.
2019-03-11 23:40:22 +01:00
. Select *Sum* in the aggregation select.
. Select *bytes* in the field select.
2019-11-11 23:34:45 +01:00
===== Set the layer style
2019-03-11 23:40:22 +01:00
2019-11-11 23:34:45 +01:00
. In *Layer style*, change *Symbol size*:
2020-01-15 23:08:33 +01:00
.. Set *Min size* to 7.
2019-03-11 23:40:22 +01:00
.. Set *Max size* to 25.
2020-01-15 23:08:33 +01:00
.. Change the field select from *count* to *sum of bytes*.
2019-03-11 23:40:22 +01:00
. Click *Save & close* button.
+
2019-05-10 21:49:07 +02:00
Your map now looks like this between zoom levels 0 and 9:
2019-03-11 23:40:22 +01:00
+
[role="screenshot"]
2020-01-15 23:08:33 +01:00
image::maps/images/sample_data_web_logs.png[]
2019-03-11 23:40:22 +01:00
2019-04-01 17:32:11 +02:00
[role="xpack"]
[[maps-save]]
2019-03-11 23:40:22 +01:00
=== Saving the map
Now that your map is complete, you'll want to save it so others can use it.
. In the application toolbar, click *Save*.
. Enter `Tutorial web logs map` for the title.
2019-11-13 22:28:51 +01:00
. Click *Save*.
2019-05-10 21:49:07 +02:00
+
You have completed the steps for re-creating the sample data map.
*Next steps:*
* Continue with this tutorial and <<maps-embedding, use your map in a Kibana dashboard>>.
* Create a map using your own data. You might find these resources helpful:
** <<heatmap-layer, Heat map layer>>
** <<tile-layer, Tile layer>>
** <<vector-layer, Vector layer>>
2019-03-11 23:40:22 +01:00
2019-05-10 21:49:07 +02:00
[role="xpack"]
[[maps-embedding]]
=== Adding the map to a dashboard
You can add your saved map to a {kibana-ref}/dashboard.html[dashboard] and view your geospatial data alongside bar charts, pie charts, and other visualizations.
. In the side navigation, click *Dashboard*.
. Click *Create new dashboard*.
. Set the time range to *Last 7 days*.
. Click *Add*.
+
A panel opens with a list of objects that you can add to the dashboard. You'll add a map and two visualizations.
+
. Set the *Types* select to *Map*.
. Click the name of your saved map or the *[Logs] Total Requests and Bytes* map included with the sample data set to add a map to the dashboard.
. Set the *Types* select to *Visualization*.
. Click *[Logs] Heatmap* to add a heatmap to the dashboard.
. Click *[Logs] Visitors by OS* to add a pie chart to the dashboard.
. Close the panel.
+
Your dashboard should look like this:
+
[role="screenshot"]
image::maps/images/gs_dashboard_with_map.png[]
2019-03-11 23:40:22 +01:00
2019-05-10 21:49:07 +02:00
==== Exploring your data using filters
2019-03-11 23:40:22 +01:00
2019-05-10 21:49:07 +02:00
You can apply filters to your dashboard to hone in on the data that you are most interested in.
The dashboard is interactive--you can quickly create filters by clicking on the desired data in the map and visualizations.
The panels are linked, so that when you apply a filter in one panel, the filter is applied to all panels on the dashboard.
2019-03-11 23:40:22 +01:00
2019-05-10 21:49:07 +02:00
. In the *[Logs] Visitors by OS* visualization, click on the *osx* pie slice.
+
Both the visualizations and map are filtered to only show documents where *machine.os.keyword* is *osx*.
The *machine.os.keyword: osx* filter appears in the dashboard query bar.
+
. Click the *x* to remove the *machine.os.keyword: osx* filter.
. In the map, click in the United States vector.
2020-04-09 19:42:30 +02:00
. Click plus image:maps/images/gs_plus_icon.png[] next to the *iso2* row in the tooltip.
2019-05-10 21:49:07 +02:00
+
Both the visualizations and the map are filtered to only show documents where *geo.src* is *US*.
The *geo.src: US* filter appears in the dashboard query bar.
+
Your dashboard should look like this:
+
[role="screenshot"]
image::maps/images/gs_dashboard_with_terms_filter.png[]