spark on es 多索引查询
核心接口
trait SparkOnEsService { val conf = new SparkConf // conf.setMaster("local[10]") val file = new File("lib").getCanonicalFile.listFiles() val fs = file.toSeq.map(f => { f.getAbsolutePath }) conf.setJars(fs) conf.setAppName("spark_sql_on_es") val sqlContext = SparkSession.builder().config(conf).getOrCreate() val options = Map("pushdown" -> "true", "es.nodes" -> "ip", "es.port" -> "prot") valt1 = sqlContext.read.format("org.elasticsearch.spark.sql").options(options).load("index/index_type") val t2 = sqlContext.read.format("org.elasticsearch.spark.sql").options(options).load("index/index_type") t1.createTempView("v1") t2.createTempView("v2") def excutor(sql: String): DataResult }