我想将一些 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"
}
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)