【发布时间】:2017-04-17 22:46:31
【问题描述】:
我有 20,000 个这种格式的 geojson 文件:
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[long,lat],
[long,lat],
[long,lat],
[long,lat],
[long,lat]
]
]
},
我用 geo_shape 和 geo_point 尝试的所有映射要么没有显示在 Kibana 中,要么显示在 kibana 中,但没有数据。将其映射到索引许多文件的最佳方法是什么? (如果没有好的方法,如果我不能使用所有坐标,我的下一个想法是为每个文件创建一个中心点。也许取第一个 long,lat 数组并将其作为每个 json 文件的 geo_point 中心点。不知道如何也可以解决这个问题)
这是我在不更改任何内容的情况下索引时来自 ES 的默认映射:
{
"indexname" : {
"mappings" : {
"my_type" : {
"properties" : {
"geometry" : {
"properties" : {
"coordinates" : {
"type" : "float"
},
"type" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}
}
},
更新 这是我的新映射:
{
"indexname" : {
"mappings" : {
"my_type" : {
"properties" : {
"geometry" : {
"type" : "geo_shape",
"tree" : "quadtree",
"precision" : "1.0m"
},
"id" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
但是,当我去 kibana 时,尝试在增强的 tilemap 上进行可视化时仍然出现错误:
No Compatible Fields: The "indexname" index pattern does not contain any of the following field types: geo_point
EDIT2 这是我创建映射的命令:
curl -XPUT "http://localhost:9200/indexname" -d "{\"mappings\" : {\"my_type\" : {\"properties\" : {\"geometry\" : {\"type\":\"geo_shape\", \"tree\": \"quadtree\", \"precision\": \"1m\"}}}}}"
我正在通过循环和发送发布请求来索引我的文件:
r = requests.post(url_of_index, data=file(jsonfiles).read())
当我尝试将类型更改为 geo_point 然后索引我的文件时,我遇到了映射器解析器异常。
【问题讨论】:
标签: python elasticsearch kibana