geojson到Elasticsearch:无法镶嵌形状 [英] geojson to Elasticsearch : Unable to Tessellate shape

查看:114
本文介绍了geojson到Elasticsearch:无法镶嵌形状的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将一些geojson文件(大约4000〜5000个多面要素)索引到Elasticsearch中.

I am indexing some geojson file (around 4000 ~ 5000 multi-polygon features) into Elasticsearch.

这里是映射

"mappings": {
       "properties": {
      "type": {
        "type": "keyword"
      },
      "properties": {
        "type": "object"
      },
      "geometry": {
        "type": "geo_shape"
      }
       }
    }

我的索引代码如下:

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

此错误的原因是什么?
索引geojson文件时可以忽略此错误吗?

What is the cause of this error?
Can I ignore this error when indexing geojson files?

推荐答案

您的geojson在语法上是正确的&有效的.现在,您只需要确保正确索引了多面:

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"
      }
    }
  }
}

在不更改任何内容的情况下为geojson编制索引:

Index the geojson w/o changing anything:

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"
      }
    }
  }
}

这篇关于geojson到Elasticsearch:无法镶嵌形状的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆