我想将一些JSON保留为看起来像这样的elastic(search):
{ "name": "value", "points": [ { "lat": 0.0, "lon": 0.0 }, { "lat": 1.0, "lon": 1.0 } ] }
点是具有弹性的geo_point类型的列表。因为它们是geo_point值,所以我需要定义索引映射,但是我能看到的最接近的方法是:
"place": { "properties": { "name": { "type": "string" }, "points": { "properties": { "location": { "type": "geo_point" } } } } }
这意味着让每个点都是具有单个位置键和geo_point值的地图。我只想要geo_points,这可能吗?
您可以如下定义映射:
"place": { "properties": { "name": { "type": "string" }, "points": { // <-- it can also be a multi-valued field if you insert multiple values, as skal88 mentioned, your json would perfectly fit in this mapping. "type": "geo_point" } } }