title: Firebase queries and compound indexes
body: <p>I have the following document structure in firebase:</p>
  
  <pre><code>{
   typeId: number,
   tripId: number,
   locationId: string,
   expenseId: number,
   createtAt: timestamp
  }
  </code></pre>
  
  <p>I want to query this collection using different 'where' statement everytime. Sometimes user wants to filter by type id and sometimes by locationId or maybe include all of the filters. </p>
  
  <p>But it seems like I would need to create a compound index of each possible permutation? For example: <code>typeId + expenseId, typeId + locationId, location + expenseId,</code> etc, otherwise it doesn't work.</p>
  
  <p>What if I have 20 fields and I want to make it possible to search across all of these?  </p>
  
  <p>Could you please help me to construct a query and indexes for the following requirement: Possibility to query across all fields, query can contain one, two, three, all or no fields included in where clause and always has to be ordered descending order by createdAt. </p>