$client_index = new CSearchLog();
    $client_index->createClient();
    $client_index->loadIndex($client_index->loadNameIndex());
    $date = CMbDT::format($date, "%Y/%m/%d");
    $words .= "date:[" . $date . " TO " . "{$date}] user_id:(" . $user_id . ")";
    $agregation = array();
    $tabActive = "";
    if (!$types) {
        $types = $client_index->loadContextes();
    }
} else {
    $client_index = new CSearch();
    $client_index->createClient();
    $client_index->loadIndex();
    $words .= " object_ref_class:" . $object_ref_class . " " . "object_ref_id:" . $object_ref_id;
    $results = $client_index->queryByType($words, null, $types);
    $agregation = $results->getAggregation("ref_type");
    $tabActive = $agregation["buckets"][0]["key"];
}
try {
    $results = $client_index->queryByType($words, $client_index->_index->getName(), $types);
    $agregation = $results->getAggregation("ref_type");
    $tabActive = $agregation["buckets"][0]["key"];
} catch (Exception $e) {
    CAppUI::displayAjaxMsg("Problème à la récupération des données", UI_MSG_ERROR);
}
$smarty = new CSmartyDP();
$smarty->assign("agregation", $agregation["buckets"]);
$smarty->assign("date", $date);
$smarty->assign("user_id", $user_id);
$smarty->assign("object_ref_class", $object_ref_class);