0

在使用 elasticsearch-hadoop 库读取具有空属性的弹性搜索索引时,出现异常

Caused by: java.lang.RuntimeException: scala.None$ is not a valid external type for schema of string

github 中存在相同的开放缺陷,并具有重现它的步骤:https ://github.com/elastic/elasticsearch-hadoop/issues/1635

Spark:3.1.1
Elasticsearch-Hadoop:elasticsearch-spark-30_2.12-7.12.0
Elasticsearch:2.3.4

4

1 回答 1

2

它通过设置 elasticsearch-hadoop 属性es.field.read.empty.as.null = no

.option("es.field.read.empty.as.null", "no")

来自 Elasticsearch链接
es.field.read.empty.as.null(默认是)elasticsearch
-hadoop 是否会将空字段视为 null。

于 2021-04-30T05:45:24.083 回答