I was wondering if there’s a way to to get the total number of objects stored in the index through the python client library?
Right now, I get the collection, run through the entire iterator and count instances?
I was wondering if there’s a way to to get the total number of objects stored in the index through the python client library?
Right now, I get the collection, run through the entire iterator and count instances?
hi @ujjwalm29 !! Welcome to our community!
iterating thru all the objects is not the optimal way.
You can aggregate over all your objects and get the top count:
aggregation = questions.aggregate.over_all(total_count=True)
print(aggregation.total_count)
Check here for more options on that: