$term =
(string) mb_eregi_replace('\s(and)\s', ' + ',
$term);
$term =
(string) mb_eregi_replace('\s(not)\s', ' -',
$term);
foreach ($entities as $entityName) { if (!
$context->
isAllowed($entityName . ':' . AclRoleDefinition::PRIVILEGE_READ
)) { continue;
} $indexer =
$this->registry->
getIndexer($entityName);
$alias =
$this->adminEsHelper->
getIndex($indexer->
getName());
$index[] =
['index' =>
$alias];
$query =
$indexer->
globalCriteria($term,
$this->
buildSearch($term,
$limit))->
toArray();
$query['timeout'
] =
$this->timeout;
$index[] =
$query;
} $responses =
$this->client->
msearch(['body' =>
$index]);
$result =
[];
foreach ($responses['responses'
] as $response) { if (empty($response['hits'
]['hits'
])) { continue;
}