amazon-web-services - AWS。通过 Glue 将数据从 S3 写入 Elasticsearch
问题描述
我有一个与 Glue 相关的问题。我当前的任务是从 S3 读取数据并将其写入 Elastisearch(在 AWS 上)。我必须使用胶水。Glue 支持从 S3 读取作为源,但不能使用 Elasticsearch 作为目标。我的问题是如何以最少的努力将数据从 Glue 写入 Elasticsearch?
解决方案
如果必须使用glue,您可以简单地利用glue 编写python 代码,而无需利用spark。将“type”配置为“python shell”的新作业。编写 python 代码,您现在可以利用 boto3 库来访问您在 S3 中的文件:
s3 = boto3.client('s3')
检索到要上传到弹性搜索的内容后,您可以使用发布请求将文档上传到弹性搜索:
r = requests.post(url, auth=awsauth, json=document, headers=headers)
请参阅下面的将流数据从 Amazon S3 加载到 Amazon ES部分中的 AWS 文档。 “将流数据加载到 Amazon Elasticsearch Service”
推荐阅读
- flutter - 如何限制文本动态变化的文本长度?
- python - AttributeError:“NoneType”对象在启动 Django 应用程序时没有属性“startswith”
- ios - iPhone 12 Pro 的 UIImagePickerController 的相机视图在它上面有很大的差距,其他手机没有这个差距
- sql - 在任何给定月份 SQL 中开始了多少次培训
- php - 无法使用isset php访问数据库
- linux - Bash 脚本:循环中的十进制增量(不能这样做)
- php - 使用 Web 服务器和 PHP 在计算机上打开应用程序
- html - 我可以显示 .webp 图像但允许用户下载 PNG 吗?
- python - 使用 Raspberry Pi 4 和 PiCam 时出现分段错误
- php - Laravel livewire 实时验证故障,移动连接速度慢