From f77a9d84fa673eda3292e9258750de6c1659d633 Mon Sep 17 00:00:00 2001 From: Enrico Zimuel Date: Wed, 14 Aug 2024 16:05:47 +0200 Subject: [PATCH] Moved SEARCH_ENDPOINTS const in Client --- src/Client.php | 13 +++++++++++++ src/Traits/EndpointTrait.php | 15 +-------------- 2 files changed, 14 insertions(+), 14 deletions(-) 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);