The Firebase Realtime Database allows ordering and querying data. For small data sizes, the database supports ad hoc querying, so indexes are generally not required during development. Before launching your app though, it is important to specify indexes for any queries you have to ensure they continue to work as your app grows.
Indexes are specified using the .indexOn
rule. Here is an example index declaration that would index the height and length fields for a list of dinosaurs:
{
"rules": {
"dinosaurs": {
".indexOn": ["height", "length"]
}
}
}