I'm storing data in firebase with this structure:
/aggregate_data/{user id}/{product id}/data
The aggregate_data collection is the root collection id and the rest subcollections, documents under it except data are dynamically generated. The data stored under data document is a map with structure
{ 'YYYYMMDD': { 'field1': value1, 'field2': value2, 'field3': value3, 'field4': value4, }, . . . . . 'YYYYMMDD': { 'field1': value1, 'field2': value2, 'field3': value3, 'field4': value4, }, }
The data inside this data document has now reached a point where it's not allowing me to add (update) more data in this map since it's being auto indexed by firebase and this error is produced as a result:
google.api_core.exceptions.InvalidArgument: 400 too many index entries for entity
I tried adding an exception in indexing to prevent indexing on this document so that I can add more data but not sure if I'm doing it the right way. So far I've tried the combinations shown below:
where sessions is one of the fields nested inside the map. Please note that the map keys YYYYMMDD are dynamically generated and contain date strings. What would be the right Collection ID & Field path combinations needed for me to stop the indexing so that I can add more data?
Solved! Go to Solution.
Collection ID: * & Field Path: sessions
This fixed the issue!
Hi @mudasir,
Welcome to Google Cloud Community!
I understand that you are hitting “too many index entries for entity” even with these setups:
I can see that you already found a workaround on the Stack Overflow question that you raised by adding exception to the entire Collection ID with the use of "*" wildcard. Likewise, you can refer to the listed recommendations below in case this occur again.
Recommendations:
Check out the best practices on how to manage your indexes for more information.
I hope the above information is helpful.
Adding exemptions in Firebase automatic indexing involves excluding specific data from being indexed to optimize search performance. Though unrelated, Smart Play (URL Removed by Staff) can help developers test and manage app performance efficiently.
Collection ID: * & Field Path: sessions
This fixed the issue!