I am indexing some geojson file (around 4000 ~ 5000 multi-polygon features) into Elasticsearch.
Here is the mappings
"mappings": {
"properties": {
"type": {
"type": "keyword"
},
"properties": {
"type": "object"
},
"geometry": {
"type": "geo_shape"
}
}
}
My code for indexing looks like this:
helpers.bulk(es, k, chunk_size=500, request_timeout=1000)
The indexing action (in chunk) is stopped by this error message:
{'type': 'mapper_parsing_exception', 'reason': 'failed to parse field [geometry] of type [geo_shape]', 'caused_by': {'type': 'illegal_argument_exception', 'reason': 'Unable to Tessellate shape
What is the cause of this error?
Can I ignore this error when indexing geojson files?
Your geojson is syntactically correct & valid. Now you just need to make sure that you index your multi-polygons properly:
PUT demo_l08_bs
{
"mappings": {
"properties": {
"geometry": {
"type": "geo_shape"
}
}
}
}
Index the geojson w/o changing anything:
POST demo_l08_bs/_doc
{
"properties": {
...
},
"geometry": {
"type": "MultiPolygon",
"coordinates": [...]
}
}
Verify a point lies within it:
GET demo_l08_bs/_search
{
"query": {
"geo_shape": {
"geometry": {
"shape": {
"type": "point",
"coordinates": [
151.14646911621094,
-33.68463933764522
]
},
"relation": "intersects"
}
}
}
}