Force field empty array to an empty object

We use Php to send JSON to elasticsearch, as such, we have sometime "[]" as en empty field that is mapped as an object (with sometimes data in it, sometimes not).

[
  {
    "_source": {
      "data": {
        "toto": 1
      },
      "hello": "worl"
    }
  },
  {
    "_source": {
      "data": {},
      "hello": "worl"
    }
  },
  {
    "_source": {
      "data": [],
      "hello": "world"
    }
  }
]

Using Spark and es4Hadoop:

sql.read.format("org.elasticsearch.spark.sql").options(

).load("test/events").foreach(println)

java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.Long

error

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.