I want to get the total results for a query using elastica for symfony2
what I did :
$u = $this->container->get('fos_elastica.finder.documents_index.documents');
$maxItems=10;
$query = new \Elastica\Query\Bool();
$elasticaQuery = new \Elastica\Query\QueryString($key_words.'~');
$elasticaQuery->setFuzzyPrefixLength(3);
$query->addMust($elasticaQuery);
try {
$q = new \Elastica\Query();
$q->setQuery($query);
$q->setFrom(($page - 1) * $maxItems);
}
catch (Exception $e) {
}
$data = $u->find($q);
$data is always 10 documents but this is not the problem , the problem is how to get the total hits so I can use them in Pagination :)