MatrixTable to Elastic

Hi,

I see that there is a function to index in Elastic but only from a Table. I am interested in indexing samples and genotypes, but into a nested field in Elastic. Do you have some function to do that?.

You can convert a matrix table to a table with nested fields using MatrixTable.localize_entries: https://hail.is/docs/0.2/hail.MatrixTable.html#hail.MatrixTable.localize_entries

Thank you!!. Yes, I saw it, but the problem is that the sampleIds goes to a global field and then if you try to transform to spark dataframe then you lose the sampleId information.

What do you want the table to look like?

Maybe the sampleIds have to be into the struct of the entries

I think this depends on what ES schema you want. One option is to export the cols table to ES separately from the entries, but then you might need to do multiple queries or a join. Alternatively, you can denormalize the data by putting the sample information in the entries before exporting to ES using annotate_entries. Something like mt.annotate_entries(entries_col = mt.col).