我正在将一些geojson文件(大约4000〜5000个多面要素)索引到Elasticsearch中。
这里是映射
"mappings": {
"properties": {
"type": {
"type": "keyword"
},
"properties": {
"type": "object"
},
"geometry": {
"type": "geo_shape"
}
}
}
我的索引代码看起来像这样:
helpers.bulk(es, k, chunk_size=500, request_timeout=1000)
索引操作(在块中)被此错误消息停止:
{'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
此错误的原因是什么?索引geojson文件时可以忽略此错误吗?
您的geojson语法正确且有效。现在,您只需要确保正确索引了多面:
PUT demo_l08_bs
{
"mappings": {
"properties": {
"geometry": {
"type": "geo_shape"
}
}
}
}
索引geojson,不更改任何内容:
POST demo_l08_bs/_doc
{
"properties": {
...
},
"geometry": {
"type": "MultiPolygon",
"coordinates": [...]
}
}
验证点位于其中:
GET demo_l08_bs/_search
{
"query": {
"geo_shape": {
"geometry": {
"shape": {
"type": "point",
"coordinates": [
151.14646911621094,
-33.68463933764522
]
},
"relation": "intersects"
}
}
}
}