ric*_*ich 5 mapping indexing elasticsearch
我想将一些 JSON 持久化到 elastic(search) 中,看起来有点像这样:
{
"name": "value",
"points": [
{ "lat": 0.0, "lon": 0.0 },
{ "lat": 1.0, "lon": 1.0 }
]
}
Run Code Online (Sandbox Code Playgroud)
点是弹性中 geo_point 类型的列表。因为它们是 geo_point 值,所以我需要定义索引映射,但我能看到的最接近的是这样做:
"place": {
"properties": {
"name": {
"type": "string"
},
"points": {
"properties": {
"location": {
"type": "geo_point"
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
这意味着让每个点都是一张地图,其中包含一个位置键和一个 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"
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2785 次 |
| 最近记录: |