title: Fetch collection on basis of array item gives "FAILED_PRECONDITION: The query requires an index"
body: <p>I am trying to fetch all questions which has "maths" tag, but instead of success it moves to failedListener.</p>
  
  <pre><code>db.collection("questionCollection")
                  .orderBy("questionID", Query.Direction.DESCENDING)
                  .whereArrayContains("tags","maths")
                  .limit(3)
                  .get()
                  .addOnSuccessListener(new OnSuccessListener&lt;QuerySnapshot&gt;() {
                      @Override
                      public void onSuccess(QuerySnapshot queryDocumentSnapshots) {
                          if (queryDocumentSnapshots.isEmpty()) {
                              Log.d(TAG, "onSuccess: LIST EMPTY");
                              return;
                          } else {
                              // Convert the whole Query Snapshot to a list
                              // of objects directly! No need to fetch each
                              // document.
                              questionList = queryDocumentSnapshots.toObjects(QuestionBO.class);
  
                              if (questionList != null &amp;&amp; questionList.size() &gt; 0)
                                  mAdapter.updateQuestions(questionList);
                          }
                      }
                  }).addOnFailureListener(new OnFailureListener() {
              @Override
              public void onFailure(@NonNull Exception e) {
                  e.printStackTrace();
                  Toast.makeText(mContext,"Failed",Toast.LENGTH_LONG).show();
              }
          });
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/VOtcG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VOtcG.png" alt="enter image description here"></a></p>
  
  <p><strong>Exception</strong></p>
  
  <pre><code>FAILED_PRECONDITION: The query requires an index. You can create it here: https://console.firebase.google.com/project/testingproject-384af/database/firestore/indexes?create_index=EhJxd
  </code></pre>