Are counts generally exact or approximate?

I know that cardinality values and terms aggregation counts are approximate, because it's mentioned in the documentation. Should I assume that if a value is not explicitly called out as being an approximation, that it is exact? (index/_count, index/_stats doc-counts, search total-hits, etc.)

This is correct. If something is expected to be approximate or potentially include error, we explicitly call that out. Otherwise you should be able to rely on counts to be accurate.

I think the only caveat are search hits. It's possible to have partial search results if one or more shard doesn't respond (for any number of reasons). I'm not sure if we call that out in the docs explicitly, but you can tell if the hits are "complete" or not by looking at the shards section in the search response. It will tell you how many shards were involved in the search, how many failed, etc.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.