Q:

Understanding MaxDocs in Elastic Search's explain feature

I am doing an elastic search 1.5.2 query with the "explain" flag turned on. The output for the inverse document frequency is 
{
    "description": "idf(docFreq=2, maxDocs=56)", 
    "value": 3.9267395
}

I understand the idea behind inverse document frequency. If I have 100 docs and one includes the word "rhododendron" then the idf = num docs / num docs with term "rhododendron" = 100 / 1
But where is the max docs number coming from in Elastic Search? I don't see anything in the documentation.

A:

The default search type is query_then_fetch in which the term and document frequency calculations are local to each of the shards in the index. That's the reason you see maxDocs=56, which could be number of docs in that shard, instead of 100 - which is total number of docs in the index.
Replacing _search by _search?search_type=dfs_query_then_fetch in your query will result in more accurate calculation of term/document frequency. More details can be found in this elastic blog

