我是做地理信息系统的,有大量的数据在postgresql数据库中,需要使用ES的空间范围搜索方法,但是前提就是要让ES识别到我导入的数据是geo_shape格式,我使用python把数据处理成一下的数据格式:
{"index":{"_index":"esdata","_type":"道路中心线_1"}}
{"name_chn": " ", "shape_length": 0.00145772657938395, "roadclass": 45000, "locat": {"type": "multilinestring", "coordinates": [[108.41492581700004,31.169573135000064],[108.41638060500009,31.169665648000034]]}, "objectid": 84539, "width": 6.0, "name_py": " ", "mesh": "H49F010004", "wkb_geometry": "0105000020E610000001000000010200000002000000009203258E1A5B40001B1D25692B3F40804AD6FAA51A5B40306A39356F2B3F40", "name_eng": " ", "road": 20.0}
上面加粗的是我需要用来计算空间范围的坐标信息,按照elasticsearch官方指导书修改为以上数据格式,使用bulk批量导入的时候报错了,错误信息如下:
{"create":{"_index":"esdata","_type":"道路中心线_1","_id":"AVYp4TqYB0ifzMhmLWct","status":400,"error":{"type":"mapper_parsing_exception","reason":"failed to parse [locat]","caused_by":{"type":"null_pointer_exception","reason":null}}}},
我的mapping如下:
curl -XPUT http://localhost:9200/esdata -d '{
"mappings":{
"道路中心线_1":{
"properties":{
"locat":{"type": "geo_shape"},
"mesh":{"type":"string"},
"name_chn":{"type":"string"},
"name_eng":{"type":"string"},
"name_py":{"type":"string"},
"objectid":{"type":"long"},
"road":{"type":"double"},
"roadclass":{"type":"long"},
"shape_length":{"type":"double"},
"width":{"type":"double"},
"wkb_geometry":{"type":"string"}
}
}
}
}'
折腾了我几个小时的时间了,实在没其他的招了,在这里跪求各路高手大神指导!!!!!!!!!!!!!
{"index":{"_index":"esdata","_type":"道路中心线_1"}}
{"name_chn": " ", "shape_length": 0.00145772657938395, "roadclass": 45000, "locat": {"type": "multilinestring", "coordinates": [[108.41492581700004,31.169573135000064],[108.41638060500009,31.169665648000034]]}, "objectid": 84539, "width": 6.0, "name_py": " ", "mesh": "H49F010004", "wkb_geometry": "0105000020E610000001000000010200000002000000009203258E1A5B40001B1D25692B3F40804AD6FAA51A5B40306A39356F2B3F40", "name_eng": " ", "road": 20.0}
上面加粗的是我需要用来计算空间范围的坐标信息,按照elasticsearch官方指导书修改为以上数据格式,使用bulk批量导入的时候报错了,错误信息如下:
{"create":{"_index":"esdata","_type":"道路中心线_1","_id":"AVYp4TqYB0ifzMhmLWct","status":400,"error":{"type":"mapper_parsing_exception","reason":"failed to parse [locat]","caused_by":{"type":"null_pointer_exception","reason":null}}}},
我的mapping如下:
curl -XPUT http://localhost:9200/esdata -d '{
"mappings":{
"道路中心线_1":{
"properties":{
"locat":{"type": "geo_shape"},
"mesh":{"type":"string"},
"name_chn":{"type":"string"},
"name_eng":{"type":"string"},
"name_py":{"type":"string"},
"objectid":{"type":"long"},
"road":{"type":"double"},
"roadclass":{"type":"long"},
"shape_length":{"type":"double"},
"width":{"type":"double"},
"wkb_geometry":{"type":"string"}
}
}
}
}'
折腾了我几个小时的时间了,实在没其他的招了,在这里跪求各路高手大神指导!!!!!!!!!!!!!
1 个回复
jacktielr - 死宅
赞同来自: