SlideShare a Scribd company logo
Elastic
March 1, 2018
@nknize
The State of Geo in Elasticsearch
Nick Knize, Elasticsearch Software Engineer
Thomas Neirynck, Kibana Visualization Area Lead
2
Geospatial capabilities are becoming more
popular among Elasticsearch Users
Topics
3
Geospatial Indexing, Search, and Visualization
1 Kibana / Elastic Maps Service
2 Geo Field Mappings
3 Geo Indexing, Search, and Lucene Data Structures
4 Geo Aggregations
Kibana / Elastic Maps Service
Kibana Visualizations
5
Out-of-the-box visualizations for geodata in Elasticsearch
2 types
- Coordinate Maps
- Region Maps
Visualize is built on top of the Elasticsearch aggregations
Coordinate Map Visualization
6
Shows result of geohash_grid aggregations.
Shows summary of all documents that belong to a single cell.
Put location of “summarized” point in the “geo-centroid” (weighted middle). This gives a
better approximate location.
The more zoomed in, the more precise the location.
Different marker-styles (bubbles, heatmap)
Example 1
Example 2
Region Maps
9
“Choropleth maps”
Thematic maps: color intensity correspond to magnitude of metric
Shows result of terms aggregations.
“Client-side” join between the result of term aggregation and a reference shape layer.
- Polygons/Multipolygons (simple feature)
- Documents in elasticsearch need to have field that matches a property of the
Request traffic
Region Maps
Vega
1
1
Experimental feature
Vega/VegaLite is a domain language in JSON to create visualizations.
Vega has support for geographic projection.
Dashboard integration
1
2
- Use map for spatial filtering of data ...
- … and have other filters applied to your map
Elastic Maps Service
Elastic Maps Service
1
4
Reference basemapping and reference data service hosted by Elastic.
“Getting started” experience for mapping.
(1) World base map
- Base for Coordinate Map, Region Map
(2) Shape layers
- World countries, US States, Germany States, Canada Provinces, USA zip-codes
- Number of identifier fields (name in one or more languages, and ISO-identifiers)
Integrating Custom Maps
Custom base maps
1
6
- (1) Configure global base-map in kibana.yml by using Tile Map Service URL
tilemap.url: https://tiles.elastic.co/v2/default/{z}/{x}/{y}
- (2) Configure visualization-specific base-map
using WMS (web map service)
- Requires 3rd party geo-service
- Geoserverb
- ArcGIS Server
- MapServer
- ….
Custom maps examples
1
7
Image Removed
Custom shape layers
1
8
- geojson/topojson
- Configure in kibana.yml -> available in region maps UI
regionmap:
includeElasticMapsService: false
layers:
- name: "Departments of France"
url: "http://my.cors.enabled.server.org/france_departements.geojson"
attribution: "INRAP"
fields:
- name: "department"
description: "Full department name"
- name: "INSEE"
description: "INSEE numeric identifier"
- Use any web-server
- Make sure is CORS enabled so Kibana can download the data (!)
- customization
- https://www.elastic.co/blog/kibana-and-a-custom-tile-server-for-nhl-data
- https://www.elastic.co/blog/custom-region-maps-in-kibana-6-0
Useful blog posts
Future
Elastic Maps Service
- More base layers (satellite, contours)
- Different stylesheets
- On-prem deployments
Kibana
- Elastic Maps Service integration with Vega
- No restriction on number of layers
- Support for geo_shape
- Visualize individual documents/custom styling
- Spatial filtering
Upcoming
Mappings
Geo Field Types
23
PUT crime/incidents/_mapping
{
“properties” : {
“location” : {
“type” : “geo_point”,
“ignore_malformed” : true,
}
}
}
define
geo_point mapping
POST crime/incidents
{
“location” : { “lat” : 41.12, “lon” : -71.34 }
}
24
insert
geo_point mapping
POST crime/incidents
{
“location” : “41.12, -71.34”
}
POST crime/incidents
{
“location” : [[-71.34, 41.12], [-71.32, 41.21]]
}
25
define
geo_shape mapping
PUT police/precincts/_mapping
{
“properties” : {
“coverage” : {
“type” : “geo_shape”,
“ignore_malformed” : false,
“tree” : ”quadtree”,
“precision” : “5m”,
“distance_error_pct“ : 0.025,
“orientation” : “ccw”,
“points_only” : false
}
}
}
26
insert
geo_shape mapping
POST police/precincts/
{
“coverage” : {
“type” : “polygon”,
“coordinates” : [[
[-73.9762134, 40.7538588],
[-73.9742356, 40.7526327],
[-73.9656733, 40.7516774],
[-73.9763236, 40.7521246],
[-73.9723788, 40.7516733],
[-73.9732423, 40.7523556],
[-73.9762134, 40.7538588]
]]
}
}
• Shapes are parsed using OGC and ISO standards definitions
• OGC Simple Feature Access
• ISO Geographic information — Spatial Schema (19107:2003)
• Supports the following geo_shape types
• Point, MultiPoint
• LineString, MultiLineString
• Polygon (with holes), MultiPolygon (with holes)
• Envelope (bbox)
geo_shape mapping
27
insert
28
geo_point mapping
Pre 5.0
29
geo_point mapping
5.0+
30
geo_shape mapping
current
31
geo_shape mapping
7.0+
‹#›
Geo Indexing
32
33
geo_point indexing
2.x term/postings encoding
term
postings
(doc ids)
1 1, 2, 3, 4, 5
10 1, 2, 4
11 3, 5
100 1
101 2, 4
111 3, 5
1000 2
1010 4
1011 3
1110 3
1111 5
34
geo_point indexing
5.0 - “points” data structure - (Bkd-tree)
35
geo_point indexing
5.0 - “points” data structure - (Bkd-tree)
36
geo_point indexing
performance improvements
37
geo_shape indexing
current - terms/postings encoding
• Max tree_levels == 32 (2 bits / cell)
• distance_error_pct
• “slop” factor to manage transient
memory usage
• % of the diagonal distance
(degrees) of the shape
• Default == 0 if precision set (2.0)
• points_only
• optimization for points only shape
index
• short-circuits recursion
38
geo_shape indexing
7.0+ - “ranges” encoding (Bkd-tree)
• Dimensional Shapes represented using Minimum Bounding Ranges (MBR)
‒ Ranges (1D) - Available from 5.1+ for numerics, dates, and IP (v4 and v6)
‒ Rectangles (2D) - LatLonBoundingBox Available in Lucene 7.1+
‒ Cubes (3D)
‒ Tesseract (4D) Quad Cells Indexed as
LatLonBoundingBox
39
geo_shape indexing
performance - 1D Numerics
‹#›
Geo Search
40
41
geo_point search
Pre 5.0 - terms/postings encoding
• Spatial Queries
• BoundingBox, Distance,
DistanceRange, Polygon
• PRECISION_STEP controls number
of query terms (must match with
index)
• TwoPhaseIterator
• Delays boundary confirmation
so other query (filters,
conjunctions) can pre-filter
42
geo_point search
5.0+ - “points” encoding (Bkd-tree)
Leaf cell is fully within polygon
(salmon) - return all docs
Leaf cell crosses the boundary
(gray) - two-phase check
1
2
43
geo_point search
5.0+ - performance improvements
44
geo_shape search
capabilities
• Supports the following geo_shape types
‒ Point, MultiPoint
‒ LineString, MultiLineString
‒ Polygon (with holes), MultiPolygon (with holes)
‒ Envelope (bbox)
• Supports relational queries
‒ INTERSECTS, DISJOINT, WITHIN, CONTAINS
45
geo_shape search
current - terms/postings encoding
Recursively Traverse
Query terms
1 2
Collect DocIDs from
Postings based on
requested relation
46
geo_shape search
7.0+ - “points” encoding (B-kd Tree)
47
geo_shape search
7.0+ - “points” encoding (B-kd Tree)
48
geo_shape search
1D numeric range performance
‹#›
Geo
Aggregations
49
‹#› 50
GeoDistance
Agg
{
"aggs" : {
“sf_rings" : {
"geo_distance" : {
"field" : "location",
"origin" : [32.95,
-96.82],
"ranges" : [
{ "to" : 50 },
{ "from" : 50,
"to" : 100 },
{ "from" : 100,
"to" : 300}
]
}
}
}
}
‹#› 51
GeoDistance
Agg
‹#› 52
GeoGrid
Agg
{
"aggs" : {
“crime_cells" : {
"geohash_grid" : {
"field" : "location",
"precision" : 8
}
}
}
}
‹#› 53
GeoGrid
Agg
‹#› 54
GeoCentroid
Agg
"query" : {
"match" : {
"crime" : "burglary"
}
},
"aggs" : {
"towns" : {
"terms" : { "field" : "town" },
"aggs" : {
"centroid" : {
"geo_centroid" : {
"field" : “location"
}
}
}
}
}
‹#› 55
GeoCentroid
Agg
‹#› 56
GeoCentroid
Agg
57
Geo Aggregations
more available, and coming soon...
• matrix_stats - (Matrix Aggs) plugin
‒ kurtosis/skewness
‒ variance-covariance matrix
‒ pearson’s product correlation matrix
• geo_stats - Future?
‒ Moran’s I - measuring spatial auto-correlation
‒ Getis-Ord - spatial hot spot analysis
Questions?
19

More Related Content

PDF
Geospatial Advancements in Elasticsearch
PDF
Geo webinarjune2015
PPTX
Getting Started with Geospatial Data in MongoDB
PDF
Comparing Geospatial Implementation in MongoDB, Postgres, and Elastic
PPTX
Drupal mapping modules
PPTX
Geospatial Indexing and Search at Scale with Apache Lucene
PDF
Geospatial and MongoDB
PPTX
Geo data analytics
Geospatial Advancements in Elasticsearch
Geo webinarjune2015
Getting Started with Geospatial Data in MongoDB
Comparing Geospatial Implementation in MongoDB, Postgres, and Elastic
Drupal mapping modules
Geospatial Indexing and Search at Scale with Apache Lucene
Geospatial and MongoDB
Geo data analytics

Similar to The state of geo in ElasticSearch (20)

PPTX
Open Source Mapping with Python, and MongoDB
PPTX
Geographica: A Benchmark for Geospatial RDF Stores
PDF
Giving MongoDB a Way to Play with the GIS Community
PDF
Geo exploration simplified with Elastic Maps
PDF
Geospatial querying in Apache Marmotta - ApacheCon Big Data Europe 2015
PPTX
Stratio's Cassandra Lucene index: Geospatial Use Cases (Andrés de la Peña & J...
PPTX
Stratio's Cassandra Lucene index: Geospatial use cases
PDF
Sparksummitny2016
PDF
Magellan-Spark as a Geospatial Analytics Engine by Ram Sriharsha
KEY
Mapping Flatland: Using MongoDB for an MMO Crossword Game (GDC Online 2011)
PPTX
Spatial_Data_Structures_Presentation.pptx
KEY
Geospatial Indexing and Querying with MongoDB
PDF
Putting Your Data on a Map
PPTX
Optimizing Geospatial Operations with Server-side Programming in HBase and Ac...
KEY
Handling Real-time Geostreams
KEY
Handling Real-time Geostreams
PPTX
Conceptos básicos. Seminario web 4: Indexación avanzada, índices de texto y g...
PDF
Geospatial Enhancements in MongoDB 2.4
PDF
Spatial functions in MySQL 5.6, MariaDB 5.5, PostGIS 2.0 and others
Open Source Mapping with Python, and MongoDB
Geographica: A Benchmark for Geospatial RDF Stores
Giving MongoDB a Way to Play with the GIS Community
Geo exploration simplified with Elastic Maps
Geospatial querying in Apache Marmotta - ApacheCon Big Data Europe 2015
Stratio's Cassandra Lucene index: Geospatial Use Cases (Andrés de la Peña & J...
Stratio's Cassandra Lucene index: Geospatial use cases
Sparksummitny2016
Magellan-Spark as a Geospatial Analytics Engine by Ram Sriharsha
Mapping Flatland: Using MongoDB for an MMO Crossword Game (GDC Online 2011)
Spatial_Data_Structures_Presentation.pptx
Geospatial Indexing and Querying with MongoDB
Putting Your Data on a Map
Optimizing Geospatial Operations with Server-side Programming in HBase and Ac...
Handling Real-time Geostreams
Handling Real-time Geostreams
Conceptos básicos. Seminario web 4: Indexación avanzada, índices de texto y g...
Geospatial Enhancements in MongoDB 2.4
Spatial functions in MySQL 5.6, MariaDB 5.5, PostGIS 2.0 and others
Ad

More from Fan Robbin (10)

PDF
reliabe by design
PDF
updates from lucene lands 2015
PDF
All about aggregations
PDF
bm25 demystified
PDF
Seven deadly sins of ElasticSearch Benchmarking
PPT
AinoVongeCorry_AnIntroductionToArchitectureQuality.ppt
PDF
广告推荐训练系统的落地实践
PDF
微博推荐引擎架构蜕变之路
PDF
Claire protorpc
PPTX
可视化的微博
reliabe by design
updates from lucene lands 2015
All about aggregations
bm25 demystified
Seven deadly sins of ElasticSearch Benchmarking
AinoVongeCorry_AnIntroductionToArchitectureQuality.ppt
广告推荐训练系统的落地实践
微博推荐引擎架构蜕变之路
Claire protorpc
可视化的微博
Ad

Recently uploaded (20)

PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
A Presentation on Artificial Intelligence
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Modernizing your data center with Dell and AMD
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Big Data Technologies - Introduction.pptx
PDF
Machine learning based COVID-19 study performance prediction
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
NewMind AI Monthly Chronicles - July 2025
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Advanced methodologies resolving dimensionality complications for autism neur...
“AI and Expert System Decision Support & Business Intelligence Systems”
Encapsulation_ Review paper, used for researhc scholars
A Presentation on Artificial Intelligence
The AUB Centre for AI in Media Proposal.docx
Chapter 3 Spatial Domain Image Processing.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Modernizing your data center with Dell and AMD
Network Security Unit 5.pdf for BCA BBA.
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Big Data Technologies - Introduction.pptx
Machine learning based COVID-19 study performance prediction
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
NewMind AI Monthly Chronicles - July 2025
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf

The state of geo in ElasticSearch