Skip to content

Unable to set Connect Timeout #22

Description

@slobo

We are unable to configure either global or per-request connection timeout when using ElasticsearchPhpHandler.

  • Without the handler, this works, and connection timeout is correctly triggered after 1 second:
<?php
ClientBuilder::create()
  ->setConnectionParams([
    'client' => [
      'connect_timeout' => 1,
    ]
  ])
  ->setHosts(['http://10.10.3.22:81']) // some address that never responds
  ->build()
  ->get([ 'index' => 'test', 'id' => 1 ]);
  • But this does not work as expected and connection is timed out after 2 minutes instead:
<?php
ClientBuilder::create()
  ->setConnectionParams([
    'client' => [
      'connect_timeout' => 1,
    ]
  ])
  ->setHandler(new ElasticsearchPhpHandler('us-east-1'))
  ->setHosts(['http://10.10.3.22:81']) // some address that never responds
  ->build()
  ->get([ 'index' => 'test', 'id' => 1 ]);
  • Same thing when using per-request, this doesn't work, while not specifying a handler does
<?php
ClientBuilder::create()
  ->setHandler(new ElasticsearchPhpHandler('us-east-1'))
  ->setHosts(['http://10.10.3.22:81']) // some address that never responds
  ->build()
  ->get([
    'index'  => 'test',
    'id'     => 1,
    'client' => [
      'connect_timeout' => 1
    ]
  ]);

Is there a way around this? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions