Creating an index for a field of same name as bucket

Hi guys,

I have a bucket setup named api that has documents in it with a field name api.
I’m wondering if it’s at all possible to create an index for this field?
I tried
CREATE INDEX api_index ON api(api)
But alas, it ended up creating an index api(self) which is not the desired effect…
Any way to do this?


CREATE INDEX api_index ON api(self.api);
Make sure you always alias the bucket in queries and use alias to use this index.

SELECT d.api , META(d).id FROM api AS d WHERE d.api > 1;

Works great! Thanks a lot! Should have realized that I just need to prefix with self.