Challenge - 5 Problems
Geo Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output of this geo-point query?
Given the following Elasticsearch query, what will be the number of hits returned if the index contains documents with geo-points at (40, -70), (41, -71), and (39, -69)?
Elasticsearch
{
"query": {
"geo_distance": {
"distance": "100km",
"location": {
"lat": 40,
"lon": -70
}
}
}
}Attempts:
2 left
💡 Hint
Think about which points fall within 100km radius of (40, -70).
✗ Incorrect
Only the point at (40, -70) is within 100km of the center point. The points at (41, -71) and (39, -69) are approximately 140km away.
🧠 Conceptual
intermediate1:30remaining
Which geo-shape type represents a polygon with holes?
In Elasticsearch geo-shape types, which of the following correctly represents a polygon with holes inside it?
Attempts:
2 left
💡 Hint
Think about how polygons with holes are defined in geojson format.
✗ Incorrect
Polygons with holes are defined by multiple linear rings: the first is the outer boundary, others are holes inside.
🔧 Debug
advanced2:30remaining
Why does this geo_shape query fail?
This geo_shape query returns an error. What is the cause?
Elasticsearch
{
"query": {
"geo_shape": {
"location": {
"shape": {
"type": "circle",
"coordinates": [-70, 40],
"radius": "100km"
},
"relation": "intersects"
}
}
}
}Attempts:
2 left
💡 Hint
Check the supported geo_shape types in Elasticsearch.
✗ Incorrect
Elasticsearch geo_shape does not support 'circle' type; it supports types like Point, Polygon, MultiPolygon, etc.
📝 Syntax
advanced1:30remaining
Identify the syntax error in this geo-point mapping
Which option contains the correct syntax for defining a geo_point field in an Elasticsearch mapping?
Attempts:
2 left
💡 Hint
Check the exact spelling of the geo_point type.
✗ Incorrect
The correct type name is 'geo_point' without hyphen or other variations.
🚀 Application
expert3:00remaining
How many shapes are indexed with this geo_shape document?
Given this document indexed in Elasticsearch with a geo_shape field 'area':
{
"area": {
"type": "geometrycollection",
"geometries": [
{ "type": "point", "coordinates": [100.0, 0.0] },
{ "type": "linestring", "coordinates": [[101.0, 0.0], [102.0, 1.0]] },
{ "type": "polygon", "coordinates": [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]] }
]
}
}
How many individual shapes does this geo_shape field contain?
Attempts:
2 left
💡 Hint
Count each geometry inside the GeometryCollection.
✗ Incorrect
A GeometryCollection contains multiple geometries; here there are 3: a point, a linestring, and a polygon.