冷魅落幕 2022-04-18 08:48 采纳率: 72.2%
浏览 112
已结题

怎么把下面的json数据 在kibana中建立索引?

"type": "FeatureCollection",
"features": [{
"type": "Feature",
"properties": {
"adcode": 110101,
"name": "东城区",
"center": [116.418757, 39.917544],
"centroid": [116.416718, 39.912934],
"childrenNum": 0,
"level": "district",
"parent": {
"adcode": 110000
},
"subFeatureIndex": 0,
"acroutes": [100000, 110000]
},
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[116.44364, 39.87284],
[116.445648, 39.879283],
[116.444059, 39.890038],
[116.450939, 39.890249],
[116.450876, 39.894088],
[116.447154, 39.894186],
[116.446819, 39.900042],
[116.448722, 39.903246],
[116.436488, 39.902042],
[116.434983, 39.913964],
[116.434314, 39.92868],
[116.443682, 39.928664],
[116.443703, 39.936663],
[116.446338, 39.946205],
[116.440566, 39.945295],
[116.442239, 39.9497],
[116.435422, 39.952121],
[116.436698, 39.949245],
[116.429483, 39.950155],
[116.429002, 39.957274],
[116.424861, 39.962279],
[116.414196, 39.962182],
[116.411415, 39.964928],
[116.411101, 39.97146],
[116.407504, 39.973995],
[116.40788, 39.962182],
[116.389498, 39.96314],
[116.387658, 39.96093],
[116.38678, 39.957014],
[116.393346, 39.957355],
[116.394266, 39.940629],
[116.396169, 39.94006],
[116.396692, 39.928306],
[116.399474, 39.923574],
[116.392175, 39.92242],
[116.392259, 39.907881],
[116.395563, 39.907995],
[116.396086, 39.89944],
[116.397612, 39.898675],
[116.399097, 39.872205],
[116.38059, 39.871148],
[116.380632, 39.866054],
[116.387888, 39.867372],
[116.394956, 39.862734],
[116.3955, 39.858682],
[116.406856, 39.859967],
[116.41246, 39.858942],
[116.41589, 39.863645],
[116.413652, 39.871148],
[116.423209, 39.872824],
[116.442574, 39.87188],
[116.44364, 39.87284]
]
]
]
}
},

  • 写回答

4条回答 默认 最新

  • 黑白码农 2022-04-18 17:13
    关注

    建立索引
    ?include_type_name=true这个是因为es7.*版本以上要求的,低于7版本的不用

    
    put  features/_doc/_mapping?include_type_name=true
    {
            "properties": {
                "adcode": {
                    "type": "long"
                },
                "name": {
                    "type": "text"
                },
                "center": {
                    "type": "geo_shape"
                },
                "centroid": {
                    "type": "geo_shape"
                },
                "childrenNum": {
                    "type": "long"
                },
                "level": {
                    "type": "text"
                },
                "parent": {
                    "type": "nested",
                    "properties":  {
                        "adcode": {
                            "type": "long"
                        }
                    }
                },
                "subFeatureIndex": {
                    "type": "long"
                },
                "acroutes": {
                    "type": "geo_shape"
                },
                "location": {
                    "type": "geo_shape"
                }
            }
    }
    
    
    

    添加数据

    
    POST features/_doc
    {
        "adcode": "110101",
      "name":"东城区",
      "center": {
        "type": "point",
        "coordinates": [ 116.418757, 39.917544 ]
      },
      "centroid": {
        "type": "point",
        "coordinates": [ 116.416718, 39.912934 ]
      },
      "childrenNum": 0,
      "level":"district",
      "parent": [
                   {
                       "adcode":110000
                   }
                ],
      "subFeatureIndex": 0,
      "acroutes": {
        "type": "point",
        "coordinates": [ 100000, 110000 ]
      },
      "location": {
        "type": "polygon",
        "coordinates":
                      [
                          [
                              [116.44364, 39.87284],
                              [116.445648, 39.879283],
                              [116.444059, 39.890038],
                              [116.450939, 39.890249],
                              [116.450876, 39.894088],
                              [116.447154, 39.894186],
                              [116.446819, 39.900042],
                              [116.448722, 39.903246],
                              [116.436488, 39.902042],
                              [116.434983, 39.913964],
                              [116.434314, 39.92868],
                              [116.443682, 39.928664],
                              [116.443703, 39.936663],
                              [116.446338, 39.946205],
                              [116.440566, 39.945295],
                              [116.442239, 39.9497],
                              [116.435422, 39.952121],
                              [116.436698, 39.949245],
                              [116.429483, 39.950155],
                              [116.429002, 39.957274],
                              [116.424861, 39.962279],
                              [116.414196, 39.962182],
                              [116.411415, 39.964928],
                              [116.411101, 39.97146],
                              [116.407504, 39.973995],
                              [116.40788, 39.962182],
                              [116.389498, 39.96314],
                              [116.387658, 39.96093],
                              [116.38678, 39.957014],
                              [116.393346, 39.957355],
                              [116.394266, 39.940629],
                              [116.396169, 39.94006],
                              [116.396692, 39.928306],
                              [116.399474, 39.923574],
                              [116.392175, 39.92242],
                              [116.392259, 39.907881],
                              [116.395563, 39.907995],
                              [116.396086, 39.89944],
                              [116.397612, 39.898675],
                              [116.399097, 39.872205],
                              [116.38059, 39.871148],
                              [116.380632, 39.866054],
                              [116.387888, 39.867372],
                              [116.394956, 39.862734],
                              [116.3955, 39.858682],
                              [116.406856, 39.859967],
                              [116.41246, 39.858942],
                              [116.41589, 39.863645],
                              [116.413652, 39.871148],
                              [116.423209, 39.872824],
                              [116.442574, 39.87188],
                              [116.44364, 39.87284]
                          ]
                      ]
      }
    }
    
    
    

    数据查询结果

    img

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

问题事件

  • 系统已结题 4月26日
  • 已采纳回答 4月18日
  • 赞助了问题酬金50元 4月18日
  • 创建了问题 4月18日

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器