我已成功将 csv 文件推送到我的 elasticsearch 中。
val spark=SparkSession.builder()
.appName("eswithfunctions")
.config("spark.master","local")
.config("spark.es.nodes","localhost")
.config("spark.es.port","9200")
.getOrCreate()
println("Enter path of file saved locally")
val path=scala.io.StdIn.readLine()
val dataframe=spark.read
.option("inferSchema", "true").csv(path)
println("Enter the name you want to save dataframe in Elasticsearch")
val index=scala.io.StdIn.readLine()
dataframe.saveToEs(index-name)
我如何从 elasticseach 服务器读取相同内容并在 spark 中以表格格式查看结果。