Creating Index in Inner Arrays


I am using CouchBase Enterprise Server 5.0.0, and below is the structure of my document where i want to create the index to search the inner array’s items -

“operatorRoundKey”: “C9D92A52F0C79F8DEF0DBD3825153850”,
“assetId”: “89D3825AECABDEB65C49DFA9057811CB”,
“name”: “OrName”,
“facilities”: [
“isClairsReviewUndertaken”: false,
“numOfHighPriortyEvents”: 0,
“subfacilities”: [
“name”: “subFacName”,
“isClairsReviewUndertaken”: true,
“id”: “3D24077C-D8BE-4C21-8F0C-DDEECCD41F4F”,
“type”: “Well”,
“events”: [
“subFacilityId”: null,
“eventId”: 120,
“eventStartDate”: null,
“status”: “New”


“name”: “facName”,
“numOfMediumPriortyEvents”: 0,
“id”: “D283FB53-0E08-44F2-81C1-8E63B87DC486”

“type”: “OperatorRound”

Can someone help me what is going wrong with below Index query -

CREATE INDEX event-ids ON ishale-db
(DISTINCT ARRAY f.subfacilities
FOR e IN events END)
FOR s IN subfacilities END)
FOR f IN facilities END)
WHERE type = “OperatorRound”;

I am getting this error
“code”: 3000,
“msg”: “syntax error - at (”,
“query_from_user”: “CREATE INDEX event-ids ON ishale-db\r\n (DISTINCT ARRAY \r\n (DISTINCT ARRAY f.subfacilities\r\n\t\t(DISTINCT ARRAY\r\n\t\t\tFOR e IN events END)\r\n\t\tFOR s IN subfacilities END)\r\n\tFOR f IN facilities END)\r\nWHERE type = “OperatorRound”;”

CREATE INDEX  `event-ids`  ON  `ishale-db` (DISTINCT ARRAY 
                                                  (DISTINCT ARRAY
                                                     (DISTINCT ARRAY e. eventId
                                                      FOR e IN END)
                                                  FOR s IN f.subfacilities END)
                                          FOR f IN facilities END)
                               WHERE type = "OperatorRound";

Thanks [vsr1], its working.