Skip to content

Commit

Permalink
Moved a few Kibana-related endpoints from daemon to Buddy (#73)
Browse files Browse the repository at this point in the history
* Moved a few Kibana-related endpoints from daemon to Buddy

* Merged 'main' into 'kibana-endpoints' branch

* Updated processing of Kibana-related endpoints

* Resolved conflicts

* Merged main into the branch

---------

Co-authored-by: nick <[email protected]>
  • Loading branch information
Nick-S-2018 and nick authored Dec 20, 2024
1 parent 2cae3fc commit 2a7d828
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 6 deletions.
Empty file modified src/ManticoreSearch/Response.php
100644 → 100755
Empty file.
39 changes: 33 additions & 6 deletions src/Network/Request.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,11 @@ protected function parseOrFail(array $payload): static {
// We need to keep the query parameters part in the sql queries
// as it's required for the following requests to Manticore
$path .= '?' . $urlInfo['query'];
} elseif (str_ends_with($path, '/_bulk')) {
} elseif (str_ends_with($path, '/_bulk') && !str_starts_with($path, '.kibana/')) {
// Convert the elastic bulk request path to the Manticore one
$path = '_bulk';
}
Buddy::debug('TEST ' . $path);
if (static::isElasticPath($path)) {
$endpointBundle = Endpoint::Elastic;
} elseif (str_contains($path, '/_doc/') || str_contains($path, '/_create/')
Expand Down Expand Up @@ -248,11 +249,37 @@ protected function parseOrFail(array $payload): static {
* @return bool
*/
protected function isElasticPath(string $path): bool {
return str_starts_with($path, '_index_template/') || str_ends_with($path, '_nodes')
|| str_starts_with($path, '_xpack') || str_starts_with($path, '.kibana/')
|| str_starts_with($path, '_cluster')
|| str_ends_with($path, '/_mapping') || str_ends_with($path, '/_search')
|| str_ends_with($path, '.kibana') || str_starts_with($path, '.kibana_task_manager');
$elasticPathPrefixes = [
'_index_template/',
'_xpack',
'.kibana/',
'_cluster',
'_mget',
'.kibana_task_manager',
'_aliases',
'_alias/',
'_template/',
'_cat/',
'_field_caps',
];
$elasticPathSuffixes = [
'_nodes',
'/_mapping',
'/_search',
'.kibana',
'/_field_caps',
];
foreach ($elasticPathPrefixes as $prefix) {
if (str_starts_with($path, $prefix)) {
return true;
}
}
foreach ($elasticPathSuffixes as $suffix) {
if (str_ends_with($path, $suffix)) {
return true;
}
}
return false;
}

/**
Expand Down
Empty file modified src/Network/Response.php
100644 → 100755
Empty file.
Empty file modified src/Task/TaskResult.php
100644 → 100755
Empty file.
Empty file modified test/BuddyCore/Network/ManticoreSearch/ClientTest.php
100644 → 100755
Empty file.
Empty file.

0 comments on commit 2a7d828

Please sign in to comment.