Elasticsearch: 错误的Geopoint栏位会引发错误

创建于 2014-03-11  ·  3评论  ·  资料来源: elastic/elasticsearch

如果在为文档建立索引时将格式错误的对象传递给了Geopoint,则该对象将引发错误。 相反,在不良地理位置之后的所有字段都将被忽略:

PUT /test
{
  "mappings": {
    "foo": {
      "properties": {
        "loc": {
          "type": "geo_point"
        }
      }
    }
  }
}

PUT /test/foo/1
{
  "loc": { "lat": 0, "lon": 0 },
  "tag": "ok"
}

PUT /test/foo/2
{
  "loc": {
    "loc": {
      "lat": 0,
      "lon": 0
    }
  },
  "tag": "not_ok"
}

GET /test/_search?search_type=count
{
  "facets": {
    "tags": {
      "terms": {
        "field": "tag"
      }
    }
  }
}

结果:

{
   "took": 1,
   "timed_out": false,
   "_shards": {
      "total": 5,
      "successful": 5,
      "failed": 0
   },
   "hits": {
      "total": 2,
      "max_score": 0,
      "hits": []
   },
   "facets": {
      "tags": {
         "_type": "terms",
         "missing": 1,
         "total": 1,
         "other": 0,
         "terms": [
            {
               "term": "ok",
               "count": 1
            }
         ]
      }
   }
}
>bug v1.1.0 v2.0.0-beta1

最有用的评论

以防万一有人用谷歌搜索相应的例外情况。 如果您尝试为Elasticsearch 1.1.0中包含不完整或其他无效geo_point字段的文档建立索引,并且会收到类似“ MapperParsingException [无法解析];嵌套:ElasticsearchParseException [field [lat]缺失];”的异常, 或“ MapperParsingException [无法解析];嵌套:ElasticsearchParseException [geo_point预期];”,解决方案是跳过整个geo_point字段。 看到这个要点: https :

所有3条评论

+1引发错误@chilling可以看看吗,这应该很简单

@ s1monw @clintongormley我会解决的

以防万一有人用谷歌搜索相应的例外情况。 如果您尝试为Elasticsearch 1.1.0中包含不完整或其他无效geo_point字段的文档建立索引,并且会收到类似“ MapperParsingException [无法解析];嵌套:ElasticsearchParseException [field [lat]缺失];”的异常, 或“ MapperParsingException [无法解析];嵌套:ElasticsearchParseException [geo_point预期];”,解决方案是跳过整个geo_point字段。 看到这个要点: https :

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

abtpst picture abtpst  ·  3评论

clintongormley picture clintongormley  ·  3评论

jpountz picture jpountz  ·  3评论

makeyang picture makeyang  ·  3评论

rjernst picture rjernst  ·  3评论