Home > other >  Spark output to the Elasticsearch error, a great god guide, please! thank you
Spark output to the Elasticsearch error, a great god guide, please! thank you

Time:09-26

The object SparkApp {

Def main (args: Array [String]) {
Val conf=new SparkConf (.) setAppName (" Test ")
The conf. Set (" es. Nodes ", "127.0.0.1:9200")

//conf. Set (" es. Nodes. The discovery ", "false")
The conf. Set (" es. Index. Auto. Create ", "true")
Val sc=new SparkContext (conf)
Val Numbers=Map (" one "-> 1," two "-> 2," three "-> 3)
Val airports=Map (" OTP "->" Otopeni ", "SFO" -> "San Fran")
Sc. MakeRDD (Seq (Numbers, airports). SaveToEs (" spark/docs ")
Sc. Stop ()

}
}



Java. Lang. StringIndexOutOfBoundsException: String index out of range: 1
The at Java. Lang. String, the substring (1967). The String Java:
At org. Elasticsearch. Hadoop. Rest. RestClient. DiscoverNodes (109) the RestClient. Java:
The at org. Elasticsearch. Hadoop. Rest. InitializationUtils. DiscoverNodesIfNeeded (58) InitializationUtils. Java:
The at org. Elasticsearch. Hadoop. Rest. RestService. CreateWriter (RestService. Java: 371)
The at org. Elasticsearch. Spark. RDD. EsRDDWriter. Write (EsRDDWriter. Scala: 38)
The at org. Elasticsearch. Spark. RDD. EsSpark $$$saveToEs anonfun $1. Apply (EsSpark. Scala: 68)
The at org. Elasticsearch. Spark. RDD. EsSpark $$$saveToEs anonfun $1. Apply (EsSpark. Scala: 68)
The at org. Apache. Spark. The scheduler. ResultTask. RunTask (ResultTask. Scala: 61)
At org. Apache. Spark. The scheduler. Task. Run (64) Task. Scala:
The at org. Apache. Spark. Executor. $TaskRunner executor. Run (executor. Scala: 203)
The at Java. Util. Concurrent. ThreadPoolExecutor. RunWorker (ThreadPoolExecutor. Java: 1142)
The at Java. Util. Concurrent. ThreadPoolExecutor $Worker. The run (ThreadPoolExecutor. Java: 617)
The at Java. Lang. Thread. The run (Thread. Java: 745)
  • Related