0
0
Elasticsearchquery~10 mins

Geo-point and geo-shape types in Elasticsearch - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a geo-point field in the mapping.

Elasticsearch
{
  "mappings": {
    "properties": {
      "location": {
        "type": "[1]"
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Ageo_shape
Btext
Ckeyword
Dgeo_point
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'geo_shape' instead of 'geo_point' for simple coordinates.
Using 'text' or 'keyword' which are not geo types.
2fill in blank
medium

Complete the code to define a geo-shape field in the mapping.

Elasticsearch
{
  "mappings": {
    "properties": {
      "area": {
        "type": "[1]"
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Ageo_point
Bgeo_shape
Cinteger
Ddate
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'geo_point' when a shape is needed.
Using non-geo types like 'integer' or 'date'.
3fill in blank
hard

Fix the error in the geo-point document by completing the coordinates array correctly.

Elasticsearch
{
  "location": {
    "type": "point",
    "coordinates": [[1]]
  }
}
Drag options to blanks, or click blank then click option'
A"lat", "lon"
B"40.12", "-71.34"
C[-71.34, 40.12]
D40.12, -71.34
Attempts:
3 left
💡 Hint
Common Mistakes
Reversing latitude and longitude order.
Using strings instead of numbers.
Including keys inside the coordinates array.
4fill in blank
hard

Fill both blanks to create a geo-shape polygon with the correct type and coordinates.

Elasticsearch
{
  "area": {
    "type": "[1]",
    "coordinates": [2]
  }
}
Drag options to blanks, or click blank then click option'
Apolygon
B[[[-70, 40], [-80, 30], [-90, 40], [-70, 40]]]
C[[-70, 40], [-80, 30], [-90, 40], [-70, 40]]
Dpoint
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'point' type for polygons.
Not nesting coordinates correctly as an array of arrays.
5fill in blank
hard

Fill all three blanks to define a geo-shape circle with the correct type, coordinates, and radius.

Elasticsearch
{
  "area": {
    "type": "[1]",
    "coordinates": [2],
    "radius": "[3]"
  }
}
Drag options to blanks, or click blank then click option'
Acircle
B[-77.03653, 38.897676]
C100m
Dpolygon
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'polygon' type for circles.
Providing radius without units.
Swapping latitude and longitude in coordinates.