gpt4 book ai didi

amazon-web-services - 将数据导入 AWS Elasticsearch 时映射 geo_point 数据

转载 作者:行者123 更新时间:2023-12-03 01:37:04 30 4
gpt4 key购买 nike

我在 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 进行搜索!

关于amazon-web-services - 将数据导入 AWS Elasticsearch 时映射 geo_point 数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51603065/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com