Skip to content

Commit

Permalink
Moved SEARCH_ENDPOINTS const in Client
Browse files Browse the repository at this point in the history
  • Loading branch information
ezimuel committed Aug 14, 2024
1 parent b293371 commit f77a9d8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
13 changes: 13 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
15 changes: 1 addition & 14 deletions src/Traits/EndpointTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit f77a9d8

Please sign in to comment.