I'm starting studies with indexes. I have a base in MongoDB where the documents have about 10 fields. Searches can be done using all these variables.
I created an index with all the fields, and I thought it would work ok, but I always get a "slow query" alert.
Do I need to create indexes for all field combinations? Some of these will be in all queries.
What is the best strategy for creating these indexes? {a:1, b:1}, {a:1, b:1, c:1}...
An example of a document in the database (only the fields that can be filtered):
{
"id": "12345",
"objectivo": 1,
"tipo": 1,
"preco": 50000,
"num_quartos": 2,
"estado": "São Paulo",
"cidade": "São Paulo",
"endereco": "Rua...",
"referencia": "12345",
"updated": 1
}