$search =
$this->
createSearch($criteria,
$definition,
$context);
$this->eventDispatcher->
dispatch( new ElasticsearchEntitySearcherSearchEvent( $search,
$definition,
$criteria,
$context ) );
$search =
$this->
convertSearch($criteria,
$definition,
$context,
$search);
try { $result =
$this->client->
search([ 'index' =>
$this->helper->
getIndexName($definition,
$this->helper->
enabledMultilingualIndex() ? null :
$context->
getLanguageId()),
'track_total_hits' => true,
'body' =>
$search,
]);
} catch (\Throwable
$e) { $this->helper->
logAndThrowException($e);
return $this->decorated->
search($definition,
$criteria,
$context);
}