Elasticsearch significant terms aggregation: meaning of doc_count and bg_count

1.5k Views Asked by At

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?

1

There are 1 best solutions below

1
On BEST ANSWER

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