elastic / elasticsearch-php

Official PHP client for Elasticsearch.
https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/index.html
MIT License
5.25k stars 963 forks source link

Path in hosts configuration is ignored #1377

Closed mikevrind closed 8 months ago

mikevrind commented 8 months ago

Summary of problem or feature request

I need to use a host in which Elastic is available via a subfolder. The host is being carried on correctly until the Transport class. There it uses the Node object to build a connection URI but the path part of the configured host is not being used.

Code snippet of problem

private function setupConnectionUri(Node $node, RequestInterface $request): RequestInterface
    {
        $uri = $node->getUri();

        return $request->withUri(
            $request->getUri()
                ->withHost($uri->getHost())
                ->withPort($uri->getPort())
                ->withScheme($uri->getScheme())
         );
    }

System details

mikevrind commented 8 months ago

Also made a PR: https://github.com/elastic/elastic-transport-php/pull/20

ezimuel commented 8 months ago

Fixed in https://github.com/elastic/elastic-transport-php/pull/21