使用 Glue 将数据输入到 AWS Elastic Search
Input data to AWS Elastic Search using Glue
我正在寻找使用 AWS Glue python 或 pyspark 将数据插入 AWS Elastic Search 的解决方案。我看过用于 Elastic Search 的 Boto3 SDK,但找不到任何将数据插入 Elastic Search 的函数。谁能帮我找到解决办法?
任何有用的链接或代码?
对于 aws glue,您需要为作业添加一个额外的 jar。
- 从 https://repo1.maven.org/maven2/org/elasticsearch/elasticsearch-hadoop/7.8.0/elasticsearch-hadoop-7.8.0.jar
下载 jar
- 将 jar 保存在 s3 上并将其传递给胶水作业。
- 现在在保存数据框时使用以下内容
df.write.format("org.elasticsearch.spark.sql").\
option("es.resource", "index/document").\
option("es.nodes", host).\
option("es.port", port).\
save()
如果您使用的是 aws 托管弹性搜索,请尝试将其设置为 true
option("es.nodes.wan.only", "true")
更多属性请查看https://www.elastic.co/guide/en/elasticsearch/hadoop/current/configuration.html
注意
elasticsearch-spark 连接器仅与 spark 2.3 兼容,因为它是在 scala 2.11 上预构建的,而 spark 2.4 和 spark 3.0 是在 scala 2.12
上预构建的
我正在寻找使用 AWS Glue python 或 pyspark 将数据插入 AWS Elastic Search 的解决方案。我看过用于 Elastic Search 的 Boto3 SDK,但找不到任何将数据插入 Elastic Search 的函数。谁能帮我找到解决办法? 任何有用的链接或代码?
对于 aws glue,您需要为作业添加一个额外的 jar。
- 从 https://repo1.maven.org/maven2/org/elasticsearch/elasticsearch-hadoop/7.8.0/elasticsearch-hadoop-7.8.0.jar 下载 jar
- 将 jar 保存在 s3 上并将其传递给胶水作业。
- 现在在保存数据框时使用以下内容
df.write.format("org.elasticsearch.spark.sql").\
option("es.resource", "index/document").\
option("es.nodes", host).\
option("es.port", port).\
save()
如果您使用的是 aws 托管弹性搜索,请尝试将其设置为 true
option("es.nodes.wan.only", "true")
更多属性请查看https://www.elastic.co/guide/en/elasticsearch/hadoop/current/configuration.html
注意 elasticsearch-spark 连接器仅与 spark 2.3 兼容,因为它是在 scala 2.11 上预构建的,而 spark 2.4 和 spark 3.0 是在 scala 2.12
上预构建的