首页 > 解决方案 > how to index each feature elasticsearch featurecollection

问题描述

I got a typical FeatureCollection json file, when I import this file via Kibana I can see that the index has docs count equivalent to a number of features in FeatureCollection, so I can do a query and get the specific feature. But when I try to index this file via java and using mapping like this, I can save the file but with docs count = 1, so I can't do geospatial query to get a specific feature.

{
  "mappings": {
    "dynamic": true,
    "properties": {
      "checksum": {
        "type": "keyword"
      },
      "geometry": {
        "properties": {
          "coordinates": {
            "type": "geo_shape"
          }
        }
      }
    }
  }
}

this is the file:

{
  "hashCode": 1708148999,
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "id": "station_exits.fid--3e26eb90_1774de53429_-64b5",
      "geometry": {
        "type": "Point",
        "coordinates": [38.5752041, 54.8366001, 75.25849601491346]
      },
      "properties": {
        "gid": 1,
        "obj_id": "004528ca-3b1f-4210-b10e-afab2d268144",
        "prefect": "SAO",
        "district": "Timit",
        "obj_name": "exits",
        "line": "xxxxx",
        "status": "xxxx",
        "link": "/view/main"
      }
    }
  ]
}

Can anyone help to make the right mapping?

标签: javaelasticsearchkibana

解决方案


推荐阅读