public function __construct( private readonly AdminSearcher
$searcher,
private readonly DefinitionInstanceRegistry
$definitionRegistry,
private readonly JsonEntityEncoder
$entityEncoder,
private readonly AdminElasticsearchHelper
$adminEsHelper ) { } #[Route(path: '/api/_admin/es-search', name: 'api.admin.es-search', methods: ['POST'], defaults: ['_routeScope' => ['administration']])]
public function elastic(Request
$request, Context
$context): Response
{ if ($this->adminEsHelper->
getEnabled() === false
) { throw ElasticsearchAdminException::
esNotEnabled();
} $term =
trim((string) $request->
get('term', ''
));
$entities =
$request->request->
all('entities'
);
if (empty($term)) { throw ElasticsearchAdminException::
missingTermParameter();
} $limit =
$request->
get('limit', 10
);