I have my values already formatted as strings, but I can't use saveJsonToES since I want to pass in meta.
My code is like this:
val cfg: Map[String, String] = Map(
ES_INPUT_JSON -> true.toString
)
def metaMap(id: String, version: Long): Map[Metadata, String] = Map(
Metadata.ID -> id,
Metadata.VERSION -> version.toString,
Metadata.VERSION_TYPE -> "external")
myRdd.map(v => (metaMap(v.id, v.version), v.jsonString)
.writeToESWithMeta(resource, cfg)
I am getting this exception:
Caused by: org.elasticsearch.hadoop.rest.EsHadoopInvalidRequest: JsonParseException[Unexpected character ('d' (code 100)): was expecting comma to separate OBJECT entries
at [Source: [B@768a0173; line: 1, column: 24]]; fragment[{"_id":813751de68ef4]
Maybe hadoop-es tries to interpret both the key and value as Json?