val conf = new SparkConf().setAppName("Test02").setMaster("local[*]")
conf.set("es.index.auto.create","true")
conf.set("es.nodes","192.168.161.101")
conf.set("es.port","9200")
conf.set("es.nodes.wan.only","true")
conf.set("es.read.field.as.array.include","array名字")//
val spark: SparkSession = SparkSession.builder().config(conf).getOrCreate()
val ess: DataFrame = spark.sqlContext.read.format("org.elasticsearch.spark.sql")
.option("inferSchema", "true")
.load("index/Type")
ess.show(false)
spark读取es数据
最新推荐文章于 2024-09-18 14:47:29 发布