我使用此命令对我的ES类型进行了一些映射
curl -XPUT 'http://localhost:9200/lbs/road5/_mapping' -d '
{
"properties": {
"location": {
"type": "geo_shape",
"tree": "quadtree",
"precision": "1m"
}
}
}
但是当我插入一些来源时,我的ES会发出这样的警告
[2014-03-25 10:12:05,754][DEBUG][action.index ] [Shadowcat] [lbs][4], node[Vtad6yMTQua7oOtIPaRtKg], [P], s[STARTED]: Failed to execute [index {[lbs][road5][4625611], source[{"osm_id":4625611,"osm_type":"residential","name":"sindang sirana elok","location":{"type":"linestring","coordinates":[[[107.5891297,-6.877704],[107.5891175,-6.8784478]]]}}]}]
org.elasticsearch.index.mapper.MapperParsingException: failed to parse [location]
at org.elasticsearch.index.mapper.geo.GeoShapeFieldMapper.parse(GeoShapeFieldMapper.java:244)
at org.elasticsearch.index.mapper.object.ObjectMapper.serializeObject(ObjectMapper.java:517)
at org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:459)
at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:515)
at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:462)
at org.elasticsearch.index.shard.service.InternalIndexShard.prepareIndex(InternalIndexShard.java:392)
at org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:203)
at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:556)
at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:426)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.NullPointerException
at org.elasticsearch.common.geo.builders.BaseLineStringBuilder.decompose(BaseLineStringBuilder.java:90)
at org.elasticsearch.common.geo.builders.BaseLineStringBuilder.decompose(BaseLineStringBuilder.java:71)
at org.elasticsearch.common.geo.builders.BaseLineStringBuilder.build(BaseLineStringBuilder.java:55)
at org.elasticsearch.index.mapper.geo.GeoShapeFieldMapper.parse(GeoShapeFieldMapper.java:231)
... 11 more
我的文档来源有什么问题?
{
"osm_id": 4625611,
"osm_type": "residential",
"name":"sindang sirana elok",
"location": {
"type": "linestring",
"coordinates": [
[[107.5891297, -6.877704], [107.5891175, -6.8784478]]
]
}
}
答案 0 :(得分:3)
您的linestring
在coordinates
中有额外的数组级别。尝试将其更改为
{
"osm_id": 4625611,
"osm_type": "residential",
"name":"sindang sirana elok",
"location": {
"type": "linestring",
"coordinates": [
[107.5891297, -6.877704], [107.5891175, -6.8784478]
]
}
}