I'm getting an error from Firebase:
Error: No index defined for read. FIREBASE WARNING: Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ".indexOn": "read" at /checkins to your security rules for better performance.
My data structure is:
checkins: {
-KwlbakCMOcjs1UhlqLv: {
read: true,
user: "someuserid"
},
-KwlysmdbSCfTI_Nz0Wo: {
read: false,
user: "someotherid"
}
}
As you can see, the direct child of checkins is a key. Based on the error message, I've tried multiple ways of writing my rules, but the error persists:
{
"rules": {
".read": true,
".write": true,
"checkins": {
"$checkinid": {
".indexOn": "read"
}
}
}
}
{
..
"checkins": {
"$checkinid": {
".indexOn": ["read"]
}
}
}
{
..
"checkins": {
".indexOn": "read"
}
}
{
..
"checkins": {
".indexOn": ["read"]
}
}
Funny thing is: I tried to switch it up to indexOn user, but then I get an error there too (same idea - no index defined). checkins is not a child of anything, and there are no other rules but the ones you see for read/write at this point.
If it helps, my query is:
db.ref( 'checkins' ).orderByChild('read').equalTo(false).on(...
and I tried with user as the index on:
db.ref( 'checkins' ).orderByChild('user').on(...
So am I missing some key thing here? Any ideas? Thanks!
.indexOndefinitions should work, as long as your data structure is indeed/checkins. - Frank van Puffelen