0

`While using elastic search library "org.elasticsearch:elasticsearch-spark-30_2.12:7.13.3" which is working fine if target is elastic search 7.10 but with opensearch 2.3 as target it is giving issue like mapping parser exception. Basically while building bulk api request it is missing index name as part of request as given below.

{"index":{"_id":50}} <-- name missing in BULK API syntax
{"name":"Bilbo","age":50}
{"index":{"_id":1000}}
{"name":"Gandalf","age":1000}
{"index":{"_id":195}}
{"name":"Thorin","age":195}
{"index":{"_id":178}}
{"name":"Balin","age":178}
{"index":{"_id":77}}
{"name":"Kili","age":77}

Below is code used

df.write
  .format( "org.elasticsearch.spark.sql" )
  .option( "es.nodes",   host )
  .option( "es.nodes",   nodes )
  .option( "es.port",    443     )
  .option( "es.net.ssl", "true"      )
  .option("es.resource",index/type)
  .option( "es.nodes.wan.only", "true" )
  .option( "es.net.http.auth.user",username)
  .option( "es.net.http.auth.pass",password)
  .mode( "append" )
  .save()

same code is writing data if target host is an elastic search host but failing with opensearch host `

Alex Ott
  • 80,552
  • 8
  • 87
  • 132

1 Answers1

0

There is an opensearch-spark library that you can build. They are going to release a maven central version soon.

https://github.com/opensearch-project/opensearch-build/issues/3385

yalkris
  • 2,596
  • 5
  • 31
  • 51