怎么把下面的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]
]
]
]
}
},

建立索引
?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

kibana中索引的基本操作(创建、删除、更新、查看) https://blog.csdn.net/qq_44886213/article/details/122638408

你是想要mapping数据还是想要java插入索引的代码?