class ElasticGraph::GraphQL::Aggregation::Resolvers::CountDetail

a potential error upper bound where we can deduce there is none.
custom shard routing logic, though, and can’t account for that in what it returns, so it may indicate
we know that no term bucket will have data from more than one shard. The datastore isn’t aware of our
routing and/or index rollover are in use. For example, when grouping on the custom shard routing field,
but I believe we may have some opportunities to provide more accurate responses to these when custom shard
Note: for now our resolver logic only uses the bucket fields returned to us by the datastore,
fields we expose to give the client control over how much detail they want.
the count we get from the datastore may not be accurate and we have multiple
Resolves the detailed ‘count` sub-fields of a sub-aggregation. It’s an object because

def approximate_value

The (potentially approximate) `doc_count` returned by the datastore for a bucket.
def approximate_value
  @approximate_value ||= bucket.fetch("doc_count")
end

def exact_value

The `doc_count`, if we know it was exact. (Otherwise, returns `nil`).
def exact_value
  approximate_value if approximate_value == upper_bound
end

def upper_bound

The upper bound on how large the doc count could be.
def upper_bound
  @upper_bound ||= bucket.fetch("doc_count_error_upper_bound") + approximate_value
end