将数据导入 AWS Elasticsearch 时映射 geo_point 数据
Mapping geo_point data when importing data to AWS Elasticsearch
我在 dynamodb 中有一组数据,我正在使用本教程将其导入 AWS Elasticsearch:https://medium.com/@vladyslavhoncharenko/how-to-index-new-and-existing-amazon-dynamodb-content-with-amazon-elasticsearch-service-30c1bbc91365
我需要将该数据的一部分映射更改为 geo_point。
我尝试在导入数据之前创建映射:
PUT user
{
"mappings": {
"_doc": {
"properties": {
"grower_location": {
"type": "geo_point"
}
}
}
}
}
当我执行此操作时,数据不会导入,但我没有收到错误。
如果我先导入数据,我就可以搜索它,尽管 grower_location: { lat: #, lon: # } 对象被映射为一个整数,我无法 运行 geo_distance.
请帮忙。
我能够通过教程中的 python 脚本导入一次数据来解决这个问题。
然后运行
GET user/_mappings
将自动生成的映射复制到剪贴板,然后,
DELETE user/
然后将复制的映射粘贴到新映射并更改 geo_point 数据的类型。
PUT user/
{
"mappings": {
"user_type": {
"properties": {
...
"grower_location": {
"type": "geo_point"
}
...
}
}
}
}
然后使用教程中的 python 脚本重新导入数据。
一切都已导入并准备好使用 geo_point!
进行搜索
我在 dynamodb 中有一组数据,我正在使用本教程将其导入 AWS Elasticsearch:https://medium.com/@vladyslavhoncharenko/how-to-index-new-and-existing-amazon-dynamodb-content-with-amazon-elasticsearch-service-30c1bbc91365
我需要将该数据的一部分映射更改为 geo_point。
我尝试在导入数据之前创建映射:
PUT user
{
"mappings": {
"_doc": {
"properties": {
"grower_location": {
"type": "geo_point"
}
}
}
}
}
当我执行此操作时,数据不会导入,但我没有收到错误。
如果我先导入数据,我就可以搜索它,尽管 grower_location: { lat: #, lon: # } 对象被映射为一个整数,我无法 运行 geo_distance.
请帮忙。
我能够通过教程中的 python 脚本导入一次数据来解决这个问题。
然后运行
GET user/_mappings
将自动生成的映射复制到剪贴板,然后,
DELETE user/
然后将复制的映射粘贴到新映射并更改 geo_point 数据的类型。
PUT user/
{
"mappings": {
"user_type": {
"properties": {
...
"grower_location": {
"type": "geo_point"
}
...
}
}
}
}
然后使用教程中的 python 脚本重新导入数据。 一切都已导入并准备好使用 geo_point!
进行搜索