How to access _id from Spark SQL?


#1

Hi,

i would access elasticsearch _id field from a SQL request through Spark Shell.

I've try this request :

>  sqlContext.sql("select `_id`,platform,avg(duration),count(*) from video group by platform").show(100)

But it's not work. Others document fields work fine.

Thank for your help.


(Costin Leau) #2

By default, the document metadata is not returned. To do so, set es.read.metadata to true as mentioned here


#3

Exactly what i need.

Thank you.


(system) #4