弹性搜索Spark错误 [英] ElasticSearch Spark Error

查看:512
本文介绍了弹性搜索Spark错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是ElasticSearch的新手,我正在尝试编写一些Apache Spark代码来将一些数据保存到ElasticSearch中。我已经进入SparkShell的以下行:

I am new to ElasticSearch and I am trying to write some Apache Spark code to save some data into ElasticSearch. I have entered the following lines into SparkShell:

 import org.elasticsearch.spark._
 val myMap = Map("France" -> "FRA", "United States" -> "US")
 val myRDD = sc.makeRDD(Seq(myMap))
 myRDD.saveToEs("Country/Abbrv")

错误:

 org.elasticsearch.hadoop.EsHadoopIlegalArgumentException:  Cannot determine write shards for [Country/Abbrv]; likely its format is incorrect (maybe it contains illegal characters?)

Spark 2.0.0
ElasticSearch-Spark 2.3.4

Spark 2.0.0 ElasticSearch-Spark 2.3.4

任何想法?

推荐答案

问题是我没有在启动spark shell之前设置--conf var。它需要如下所示:

The issue was that I did not set the --conf var before launching spark shell. It needs to look like the following:

 spark-shell --jars {path}/elasticsearch-spark_2.11-2.3.4.jar --conf spark.es.resource=Country/Abbrv

这篇关于弹性搜索Spark错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆