Saving a DataFrame to Couchbase

Hi,

I am trying to save a Spark DataFrame (extracted from ElasticSearch) following the documentation here:
http://developer.couchbase.com/documentation/server/current/connectors/spark-1.2/spark-sql.html

It looks like I have to explicitly specify a column in the DataFrame that will be used as the ID field, but the data I have is unstructured and different documents have different fields… so for unstructured data, how can I decide which field to use as the document ID? Is it possible to have Couchbase generate the ID automatically?

Thanks,
Dan

You can use uuid function/class to generate random unique number. example below-

n1ql query-
insert into mybucket values (uuid(),{“name”: “John”,“age”:30});

From spark-
JsonDocument.create(UUID.randomUUID().toString(), content)