Shridevi Bhat
Shridevi Bhat

Reputation: 91

Using an unspecified index. Consider adding ".indexOn": "phone" at /use_frameworks_beta_2/searchIndex to your security rules for better performance

I have an iOS app where I have to implement a simple chat between two users. I am registering the users to Firebase during app registration. All work good. But when I have to start a chat thread I am searching for a user using search indexes but I am getting following error:

Using an unspecified index. Consider adding ".indexOn": "phone" at /use_frameworks_beta_2/searchIndex to your security rules for better performance Using an unspecified index. Consider adding ".indexOn": "email" at /use_frameworks_beta_2/searchIndex to your security rules for better performance Using an unspecified index. Consider adding ".indexOn": "name" at /use_frameworks_beta_2/searchIndex to your security rules for better performance

The Rules in Firebase console is as follows

{ "rules": { ".read": true, ".write": true, "searchIndex": { ".indexOn": ["email","phone","name"] } } }

Please help me fixing this error.

Upvotes: 0

Views: 931

Answers (1)

Bob Snyder
Bob Snyder

Reputation: 38299

The .indexOn specifier must be placed in the rules at the location containing the indexed keys. Update your rules to place .indexOn at the correct location in the tree:

{
  "rules": {
    ".write": true,
    ".read": true,
    "use_frameworks_beta_2": {
      "searchIndex ": {
        ".indexOn": ["email","phone","name"]
      }
    }
  }
}

Upvotes: 3

Related Questions