Reputation: 2300
How to find the total number of entries in an entity type in App Engine Datastore using Low Level API?
I there a function or filter to query for this purpose?
I am using Java to implement this.
Upvotes: 0
Views: 276
Reputation: 2703
App Engine has an API for getting datastore statistics programmatically:
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
Entity globalStat = datastore.prepare(new Query("__Stat_Total__")).asSingleEntity();
Long totalBytes = (Long) globalStat.getProperty("bytes");
Long totalEntities = (Long) globalStat.getProperty("count")
See the documentation: https://cloud.google.com/appengine/docs/java/datastore/stats
You can get entities of a kind using __Stat_Kind__
Upvotes: 1