How to access _id from Spark SQL?

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.

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

1 Like

Exactly what i need.

Thank you.