array:1 [ "DEBUG_OPENSEARCH_QUERY" => array:2 [ "index" => "events" "body" => array:3 [ "query" => array:1 [ "script_score" => array:2 [ "query" => array:1 [ "bool" => array:1 [ "filter" => array:2 [ 0 => array:1 [ "term" => array:1 [ "cp" => 29200 ] ] 1 => array:1 [ "range" => array:1 [ "date_fin" => array:1 [ "gte" => "now/d" ] ] ] ] ] ] "script" => array:1 [ "source" => """ \n double base = _score;\n \n // 1) Booster les événements qui finissent bientôt\n if (doc['date_fin'].size() > 0) {\n long today = new Date().getTime();\n long fin = doc['date_fin'].value.toInstant().toEpochMilli();\n long diffDays = Math.abs(fin - today) / (1000L * 60 * 60 * 24);\n \n base += (100.0 / (diffDays + 1));\n }\n \n // 2) Booster les événements courts\n if (doc['date_deb'].size() > 0 && doc['date_fin'].size() > 0) {\n long deb = doc['date_deb'].value.toInstant().toEpochMilli();\n long fin = doc['date_fin'].value.toInstant().toEpochMilli();\n long duration = (fin - deb) / (1000L * 60 * 60 * 24);\n \n base += (50.0 / Math.max(duration + 1, 1));\n }\n \n return base;\n """ ] ] ] "from" => 10260 "size" => 20 ] ] ]
} elseif ($statusCode === 400 && strpos($responseBody, 'script_lang not supported') !== false) { $exception = new ScriptLangNotSupportedException($responseBody); } elseif ($statusCode === 408) { $exception = new RequestTimeout408Exception($responseBody); } else { $exception = new BadRequest400Exception($responseBody); } $this->logRequestFail($request, $response, $exception); throw $exception; // Skip 404 if succeeded true in the body (e.g. clear_scroll) $body = $response['body'] ?? ''; if (strpos($body, '"succeeded":true') !== false) { $ignore[] = 404; } $this->process4xxError($request, $response, $ignore); } elseif ($response['status'] >= 500) { $ignore = $request['client']['ignore'] ?? []; $this->process5xxError($request, $response, $ignore); } try { /** * @var PromiseInterface<T>|T $result */ $result = $onFulfilled($this->value); return resolve($result); } catch (\Throwable $exception) { return new RejectedPromise($exception); } } */ public function then( ?callable $onFulfilled = null, ?callable $onRejected = null ) { return $this->promise()->then($onFulfilled, $onRejected); }} ?callable $onFulfilled = null, ?callable $onRejected = null, ?callable $onProgress = null ) { return new FutureArray( $future->then($onFulfilled, $onRejected, $onProgress), [$future, 'wait'], [$future, 'cancel'] ); } return function (array $request, Connection $connection, ?Transport $transport, $options) use ($handler) { $this->lastRequest = []; $this->lastRequest['request'] = $request; // Send the request using the wrapped handler. $response = Core::proxy( $handler($request), function ($response) use ($connection, $transport, $request, $options) { $this->lastRequest['response'] = $response; if (isset($response['error']) === true) { if (empty($request['client'])) { unset($request['client']); } $handler = $this->handler; $future = $handler($request, $this, $transport, $options); return $future; } public function getTransportSchema(): string $response = []; $caughtException = null; $this->lastConnection = $connection; $future = $connection->performRequest( $method, $uri, $params, $body, $options, mixed $body = null, array $headers = [], ): iterable|string|null { // Provide legacy support for options. $options = $headers; $promise = $this->transport->performRequest($method, $uri, $params, $body, $options); return $this->transport->resultOrFuture($promise, $options); }} * @throws \Psr\Http\Client\ClientExceptionInterface * @throws \OpenSearch\Exception\HttpExceptionInterface */ private function performRequest(AbstractEndpoint $endpoint): iterable|string|null { return $this->httpTransport->sendRequest( $endpoint->getMethod(), $endpoint->getURI(), $endpoint->getParams(), $endpoint->getBody(), $endpoint->getOptions() $endpoint = $this->endpointFactory->getEndpoint(Search::class); $endpoint->setParams($params); $endpoint->setIndex($index); $endpoint->setBody($body); return $this->performRequest($endpoint); } /** * Returns information about the indexes and shards that a search request would be executed against. * ]; // DEBUG OpenSearch dans les logs de Symfony dump(['DEBUG_OPENSEARCH_QUERY' => $params]); $response = $this->client->search($params); return [ 'total' => $response['hits']['total']['value'] ?? 0, 'results' => array_map( fn ($hit) => $hit['_source'], 'cp' => $filters['cp'] ?? null, 'future_only'=> true ]; // 🔍 Recherche OpenSearch $osResult = $search->search($osFilters, $page, 20); // Hydratation SQL via prepareEvent $events = []; foreach ($osResult['results'] as $doc) { $this->dispatcher->dispatch($event, KernelEvents::CONTROLLER_ARGUMENTS); $controller = $event->getController(); $arguments = $event->getArguments(); // call controller $response = $controller(...$arguments); // view if (!$response instanceof Response) { $event = new ViewEvent($this, $request, $type, $response, $event); $this->dispatcher->dispatch($event, KernelEvents::VIEW); $request->headers->set('X-Php-Ob-Level', (string) ob_get_level()); $this->requestStack->push($request); $response = null; try { return $response = $this->handleRaw($request, $type); } catch (\Throwable $e) { if ($e instanceof \Error && !$this->handleAllThrowables) { throw $e; } $this->boot(); ++$this->requestStackSize; $this->resetServices = true; try { return $this->getHttpKernel()->handle($request, $type, $catch); } finally { --$this->requestStackSize; } } ) { } public function run(): int { $response = $this->kernel->handle($this->request); if (Kernel::VERSION_ID >= 60400) { $response->send(false); if (\function_exists('fastcgi_finish_request') && !$this->debug) {$app = $app(...$args);exit( $runtime ->getRunner($app) ->run());<?phpuse App\Kernel;require_once dirname(__DIR__).'/vendor/autoload_runtime.php';return function (array $context) { return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);};|
BadRequest400Exception
|
|---|
OpenSearch\Common\Exceptions\BadRequest400Exception:
{"error":{"root_cause":[{"type":"circuit_breaking_exception","reason":"[script] Too many dynamic script compilations within, max: [75/5m]; please use indexed, or scripts with parameters instead; this limit can be changed by the [script.context.score.max_compilations_rate] setting","bytes_wanted":0,"bytes_limit":0,"durability":"TRANSIENT"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"events","node":"YcnZBNnhQ2OSMo7JVAsJYA","reason":{"type":"query_shard_exception","reason":"failed to create query: Failed to compile inline script [\n double base = _score;\n\n // 1) Booster les événements qui finissent bientôt\n if (doc['date_fin'].size() > 0) {\n long today = new Date().getTime();\n long fin = doc['date_fin'].value.toInstant().toEpochMilli();\n long diffDays = Math.abs(fin - today) / (1000L * 60 * 60 * 24);\n\n base += (100.0 / (diffDays + 1));\n }\n\n // 2) Booster les événements courts\n if (doc['date_deb'].size() > 0 && doc['date_fin'].size() > 0) {\n long deb = doc['date_deb'].value.toInstant().toEpochMilli();\n long fin = doc['date_fin'].value.toInstant().toEpochMilli();\n long duration = (fin - deb) / (1000L * 60 * 60 * 24);\n\n base += (50.0 / Math.max(duration + 1, 1));\n }\n\n return base;\n ] using lang [painless]","index":"events","index_uuid":"17_tYZt_TLObmDDYp0bjBQ","caused_by":{"type":"circuit_breaking_exception","reason":"[script] Too many dynamic script compilations within, max: [75/5m]; please use indexed, or scripts with parameters instead; this limit can be changed by the [script.context.score.max_compilations_rate] setting","bytes_wanted":0,"bytes_limit":0,"durability":"TRANSIENT"}}}],"caused_by":{"type":"circuit_breaking_exception","reason":"[script] Too many dynamic script compilations within, max: [75/5m]; please use indexed, or scripts with parameters instead; this limit can be changed by the [script.context.score.max_compilations_rate] setting","bytes_wanted":0,"bytes_limit":0,"durability":"TRANSIENT"}},"status":400}
at vendor/opensearch-project/opensearch-php/src/OpenSearch/Connections/Connection.php:680
at OpenSearch\Connections\Connection->process4xxError()
(vendor/opensearch-project/opensearch-php/src/OpenSearch/Connections/Connection.php:338)
at OpenSearch\Connections\Connection->OpenSearch\Connections\{closure}()
(vendor/react/promise/src/Internal/FulfilledPromise.php:47)
at React\Promise\Internal\FulfilledPromise->then()
(vendor/ezimuel/ringphp/src/Future/CompletedFutureValue.php:66)
at GuzzleHttp\Ring\Future\CompletedFutureValue->then()
(vendor/ezimuel/ringphp/src/Core.php:341)
at GuzzleHttp\Ring\Core::proxy()
(vendor/opensearch-project/opensearch-php/src/OpenSearch/Connections/Connection.php:270)
at OpenSearch\Connections\Connection->OpenSearch\Connections\{closure}()
(vendor/opensearch-project/opensearch-php/src/OpenSearch/Connections/Connection.php:248)
at OpenSearch\Connections\Connection->performRequest()
(vendor/opensearch-project/opensearch-php/src/OpenSearch/Transport.php:117)
at OpenSearch\Transport->performRequest()
(vendor/opensearch-project/opensearch-php/src/OpenSearch/LegacyTransportWrapper.php:34)
at OpenSearch\LegacyTransportWrapper->sendRequest()
(vendor/opensearch-project/opensearch-php/src/OpenSearch/Client.php:2285)
at OpenSearch\Client->performRequest()
(vendor/opensearch-project/opensearch-php/src/OpenSearch/Client.php:1622)
at OpenSearch\Client->search()
(src/Service/EventSearchService.php:244)
at App\Service\EventSearchService->search()
(src/Controller/SearchController.php:55)
at App\Controller\SearchController->index()
(vendor/symfony/http-kernel/HttpKernel.php:183)
at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
(vendor/symfony/http-kernel/HttpKernel.php:76)
at Symfony\Component\HttpKernel\HttpKernel->handle()
(vendor/symfony/http-kernel/Kernel.php:182)
at Symfony\Component\HttpKernel\Kernel->handle()
(vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php:35)
at Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run()
(vendor/autoload_runtime.php:29)
at require_once('/var/www/vhosts/sortir-en-bretagne.fr/httpdocs/vendor/autoload_runtime.php')
(public/index.php:5)
|