Add 'count' endpoint

Registered by Steve McLellan

It's been suggested (by Brian Rosmaita) that something that might be useful, especially when looking at multi-region deployments, is the ability to quickly get a summary of counts of types.

We don't expose the aggregations API directly (perhaps we should) but even if we did, it would be useful similarly to facets to expose an explicit endpoint to return a summary of accessible result counts in the format:

{"OS::Nova::Server": {"doc_count": 6}, "OS::Neutron::Net": {"doc_count": 2}}

I don't see any reason not to allow queries and the usual index/type restrictions similar to faceting; this will be a shortcut to insert the aggregation and set size=0 on a query, plus formatting the results in a nicer fashion.

This doesn't preclude adding the ability to run arbitrary aggregations; it's a convenience function with a very clear remit (just as facets).

EDIT - in fact, it occurs that this could be part of the facet response since it's very similar, though unfortunately the facet api response is {"resource type": [facets]} which doesn't lend itself well to adding additional info.

Blueprint information

Travis Tripp
Steve McLellan
Steve McLellan
Series goal:
Accepted for newton
Milestone target:
milestone icon newton-3
Started by
Travis Tripp
Completed by
Travis Tripp

Related branches



After some discussion, our decision is to go with altering the facets endpoint but maintaining back-compatilbility through newton.

We'll add ?include_totals and ?include_fields to the /facet endpoint. The presence of either will result in the return document following the format {"resource_type": {"doc_count": 4, "facets": [facets]}}. The UI and client will be updated to expect the new format, and explicitly pass these options.

For Newton, if neither is specified, the existing format will be preserved (treating the default as include_totals=false, include_fields=true). Post-Newton the old behavior will be removed.

Gerrit topic:,topic:bp/count-endpoint,n,z

Addressed by:
    Add totals to facets

Gerrit topic:,topic:bp/s,n,z

Addressed by:
    Support new facet response format

Addressed by:
    Handle new-format facets response


Work Items

This blueprint contains Public information 
Everyone can see this information.


No subscribers.