Cassandra, Spark, Elasticsearch: streaming data for visualisation in kibana
According to Spark Cassandra Connector Guide, you can first define a case class, then convert the CassandraRow to the case class objects, then save the objects to Elasticsearch. Below is the sample code from the guide:
case class WordCount(w: String, c: Int)object WordCount { implicit object Mapper extends DefaultColumnMapper[WordCount]( Map("w" -> "word", "c" -> "count")) }sc.cassandraTable[WordCount]("test", "words").toArray// Array(WordCount(bar,20), WordCount(foo,10))sc.parallelize(Seq(WordCount("baz", 30), WordCount("foobar", 40))) .saveToCassandra("test", "words", SomeColumns("word", "count"))