So the deal:
If you want to fulfill a query - inequality or equality - in one field you do not need an index. (Even if this field is a property in the map field, for example, your top example.)
If you want to execute an equality query for multiple fields, you also do not need a special index.
If you want to execute a query consisting of 1 or more queries for equality, followed by either a search for inequality, or โorder byโ in another field, then you need a special index. And you are currently limited to 125 different user indexes in the same database.
So, with that in mind, Iโm not sure that you can execute exactly the query you are looking for without creating custom indexes for each of them.
One way to solve the problem would be to fulfill the request without ordering the results, and then order them on the client.
Or, as nshmura suggested, you can try another workaround to add the metric value to the variable you are requesting. Therefore, instead of structuring your data, for example:
user { var1: true, var2: true, var3: true, metric: 10 }
You might want to structure your data, for example:
user { var1: 10, var2: 10, var3: 10, metric: 10 }
Then you can do a search like
const snapshot = await db.collection('users') .where(varId, '>', 0) .limit(100) .get()
And it will be automatically sorted by this value. Regardless of whether it really works, your particular use case probably depends a lot.