2
我有以下代码来保存数据框到弹性搜索。它运作良好。如何使用映射将数据框保存到Elasticsearch
val conf = new SparkConf(true).set("spark.cassandra.connection.host", host)
conf.set("spark.es.index.auto.create", "true")
conf.set("spark.es.nodes", host)
val features = sqlContext.read.parquet(input)
features.write.format("org.elasticsearch.spark.sql")
.mode(SaveMode.Append)
.option("es.resource","{ts}/log").save()
它自动创建索引时,它不存在。但是当我试图在某个领域进行查询时。它显示了以下错误
Set fielddata=true on [country] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.
我知道的映射,使文本字段作为关键字
{
"your_field": {
"type" "keyword",
"index": true
}
}
但我怎么也找不到与此代码