/**
* Count document into the index and then multiply it by the request cutoff frequency
* to compute an absolute cutoff frequency limit (max numbre of doc).
*
* @param RequestInterface $request The spellcheck request.
*
* @return int
*/
private function getCutoffrequencyLimit(RequestInterface $request)
{
$indexStatsResponse = $this->client->indices()->stats(['index' => $request->getIndex()]);
$indexStats = current($indexStatsResponse['indices']);
$totalIndexedDocs = $indexStats['total']['docs']['count'];
return $request->getCutoffFrequency() * $totalIndexedDocs;
}