diff --git a/src/Client.php b/src/Client.php index 7bd1ecb9a..64d2608dc 100644 --- a/src/Client.php +++ b/src/Client.php @@ -31,6 +31,19 @@ final class Client implements ClientInterface const VERSION = '8.15.0'; const API_COMPATIBILITY_HEADER = '%s/vnd.elasticsearch+%s; compatible-with=8'; + const SEARCH_ENDPOINTS = [ + 'search', + 'async_search.submit', + 'msearch', + 'eql.search', + 'terms_enum', + 'search_template', + 'msearch_template', + 'render_search_template', + 'esql.query', + 'knnSearch' + ]; + use ClientEndpointsTrait; use EndpointTrait; use NamespaceTrait; diff --git a/src/Traits/EndpointTrait.php b/src/Traits/EndpointTrait.php index 5aa2ca652..c248483f9 100644 --- a/src/Traits/EndpointTrait.php +++ b/src/Traits/EndpointTrait.php @@ -31,19 +31,6 @@ trait EndpointTrait { - const SEARCH_ENDPOINTS = [ - 'search', - 'async_search.submit', - 'msearch', - 'eql.search', - 'terms_enum', - 'search_template', - 'msearch_template', - 'render_search_template', - 'esql.query', - 'knnSearch' - ]; - /** * Check if an array containts nested array */ @@ -230,7 +217,7 @@ protected function addOtelAttributes( $otel["db.elasticsearch.path_parts.$part"] = $params[$part]; } } - if (in_array($endpoint, self::SEARCH_ENDPOINTS)) { + if (in_array($endpoint, Client::SEARCH_ENDPOINTS)) { $body = $request->getBody()->getContents(); if (!empty($body)) { $otel['db.query.text'] = OpenTelemetry::redactBody($body);