How do I figure out what type of indexes to create for the following query:
SELECT META(`contacts`).id, `contacts`.* FROM `somebucket` contacts INNER JOIN `somebucket` locations ON `locations`.id IN (ARRAY location.id FOR location IN `contacts`.locations END) AND `locations`.type = "location" AND `locations`.tenant = "tenant::sometenant" INNER JOIN `somebucket` users ON `locations`.territory IN `users`.territories AND `users`.type = "user" AND `users`.tenant = "tenant::sometenant" WHERE `contacts`.type = "contact" AND `contacts`.tenant = "tenant::sometenant" AND META(`users`).id = "sometenant::user::36da3a63-a57c-405c-8f2a-6570de058f75"
I have read a few articles and still do not get how I should proceed. I have tried to create several indexes with mixed results. I would like the indexes, but I want to understand the process.