4

I am having trouble finding documentation to explain the doc_count and bg_count fields in the response to the significant terms aggregation.

For example I would expect that, if I do not set a background filter, the bg_count should the the total number of documents in the index. However what I see is that the bg_count is not the same for each result, and it isn't anywhere near the total number of documents.

I assume that doc_count is the number of documents containing the returned key.

What is the actual meaning of these values? Where can I find more complete documentation for that?

Metropolis
  • 2,018
  • 1
  • 19
  • 36
  • 1
    I'm facing the same issue and I'm not convinced that the answer is as simple as @Val said. `bg_count` seems to also include deleted documents (it matches the values returned by the `_stats` endpoint) – João Almeida Dec 30 '21 at 12:39

1 Answers1

5

Very simply:

  • doc_count is the number of documents in the result set with the given term
  • bg_count is the number of documents in the whole index with the given term
Val
  • 207,596
  • 13
  • 358
  • 360