【问题标题】:ElasticSearch Spark ErrorElasticSearch 火花错误
【发布时间】:2018-09-17 19:56:33
【问题描述】:

我是 ElasticSearch 的新手,我正在尝试编写一些 Apache Spark 代码来将一些数据保存到 ElasticSearch。我在 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?)

火花 2.0.0 ElasticSearch-Spark 2.3.4

有什么想法吗?

【问题讨论】:

    标签: elasticsearch apache-spark


    【解决方案1】:

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

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

    【讨论】:

      【解决方案2】:
      org.elasticsearch.hadoop.EsHadoopIllegalArgumentException: Cannot determine write shards for [custAct_index/custAct_index_type]; likely its format is incorrect (maybe it contains illegal characters?)
      

      由于命名约定,它会产生此错误。 将大写字符更改为小写即可解决问题。

      custAct_index/custAct_index_type ---> cust_act_index/cust_act_index_type
      

      这个修复对我有用...

      【讨论】:

        猜你喜欢
        • 2017-07-08
        • 2016-03-30
        • 2020-07-26
        • 1970-01-01
        • 2018-06-19
        • 2019-01-13
        • 1970-01-01
        • 2019-01-22
        • 2017-11-24
        相关资源
        最近更新 更多