Hi everyone,
I have my data organized in following manner:
KEY: id1 (This is primary index, meta().id)
{ "id": "id1", "subdata": [ { "subID": "subid1", "subDescription": "some data here" }, { "subID": "subid2", "subDescription": "some data here" } ] }
Similarly I have multiple documents. I am wondering how to create an index on subID element of array in the document, so that it will act as a secondary index. I have thousands of json objects under subdata field.
When I say secondary index, I meant that I will do a query with WHERE condition having both meta().id and subID.
CREATE INDEX doc_subID ON `doc-sample`
(ALL DISTINCT ARRAY v.subID FOR v IN subdata END);
If I am not wrong, above will create index across all arrays in all documents of the collection. Whereas I would prefer to have it kind of secondary index, so first it will search based on primary index using id and for that document, it will search in the array using secondary index of subID.