How to create an index in Elasticsearch using elasticsearch-spark?

89 views Asked by At

I want to create an index in Elasticsearch from my spark transformation. I wonder what is the best method to do it using the elasticsearch-spark library ? Kind regards

1

There are 1 answers

0
Sunder R On

When writing to the elasticsearch it will create an index if not present

df.write
  .format("org.elasticsearch.spark.sql")
  .option("es.nodes.wan.only","true")
  .option("es.port","443")
  .option("es.nodes", esURL)
  .mode("Overwrite")
  .save("index/dogs")