Creating an Index

Hi all, I am a NIQL newbie and am struggling to create an index for gender. When I create an index with the syntax:
CREATE INDEX gender_ID ON sandbox(gender)
the index is created successfully but no items are displayed on the Index summary page. I include a screenshot of the structure of a document in my bucket

Any help would be greatly appreciated!



gender is not top filed in the document. Index field must be referenced with path from top of the document. It is part of ARRAY entry, If you need index array element you must use ARRAY indexing.

CREATE INDEX  ix1  ON  `sandbox` ( DISTINCT ARRAY g.resource.gender FOR g IN entry END ) WHER type = "searchset";
FROM sandbox 
WHERE type = "searchset" AND ANY g IN entry SATISFIES g.resource.gender = "male" END;

Thanks very much, this is working well!

1 Like