title: How to add index rules for Firebase database?
body: <p>I keep getting firebase messages on console regarding to add indexOn for user 4321 at chat rules. Below is my database.</p>
  
  <p><a href="https://i.stack.imgur.com/trZet.png" rel="noreferrer"><img src="https://i.stack.imgur.com/trZet.png" alt="enter image description here"></a></p>
  
  <p>And my rules in firebase is like:</p>
  
  <pre><code>{
    "rules": {
      ".read": "auth != null",
      ".write": "auth != null",
      "users": {
        ".indexOn": ["name", "email","uid"],
        "$uid": {
          ".write": "$uid === auth.uid"
        }
      },
      "chats": {
        "$key": {
          ".indexOn": ["uid"] 
        }
      }
     }
  }
  </code></pre>
  
  <p>I'm not sure why the indexing not working. And how can I improve indexing for overall database?</p>