I'm looking for a solution to insert data to AWS Elastic Search using AWS Glue python or pyspark. I have seen Boto3 SDK for Elastic Search but could not find any function to insert data into Elastic Search. Can anyone help me to find solution ? Any useful links or code ?
For aws glue you need to add an additional jar to the job.
df.write.format("org.elasticsearch.spark.sql").\
option("es.resource", "index/document").\
option("es.nodes", host).\
option("es.port", port).\
save()
If you are using aws managed elastic search, try setting this to true
option("es.nodes.wan.only", "true")
For more properties check https://www.elastic.co/guide/en/elasticsearch/hadoop/current/configuration.html
NOTE The elasticsearch-spark connector is compatible with spark 2.3 only as it is prebuilt on scala 2.11 while spark 2.4 and spark 3.0 is prebuilt on scala 2.12