API Reference / API Methods / Advanced / Configuring timeouts

Configuring Timeouts

Required API Key: no ACL required
Method signature
$config = SearchConfig::create('YourApplicationID', 'YourAdminAPIKey');
$config->setConnectTimeout(integer connectTimeout);
$config->setReadTimeout(integer readTimeout);
$config->setWriteTimeout(integer writeTimeout);

SearchClient::createWithConfig($config);

About this method

You are currently reading the documentation of the JavaScript API Client v4. Read our migration guide to learn how to upgrade from v3 to v4. You can still access the v3 documentation.

Override the pre-configured timeouts.

Network & DNS resolution can be slow. That is why we have pre-configured timeouts. We do not advise to change them, but it could make sense to change them in some special cases.

Note: Not all parameters are available for every language. See Parameters below.

Examples

1
2
3
4
5
6
$config = SearchConfig::create('YourApplicationID', 'YourAdminAPIKey');
$config->setConnectTimeout(2);
$config->setReadTimeout(30);
$config->setWriteTimeout(30);

SearchClient::createWithConfig($config);

Parameters

connectTimeout
type: integer
default:
Optional

Timeout for the tcp session to connect.

Only available for the following languages: javascript, php, python, ruby, java, android, go, scala.

readTimeout
type: integer
default:
Optional

Timeout for the read on the tcp socket.

Available in all languages.

writeTimeout
type: integer
default:
Optional

Same as requestTimeout but applies only to write operations.

Only available for the following languages: javascript, kotlin, csharp, swift.

hostDownDelay
type: integer
default:
Optional

The expected period of time for a down host to get back up again. Impacts the time between API Client retries.

Only available for the following languages: android, scala.

dnsTimeout
type: integer
default:
Optional

Timeout for the dns resolution.

Only available for the following languages: csharp, scala.

searchBatchTimeout
type: integer
default:
Optional

Same as requestTimeout but applies only to batch operations.

Only available for the following language: ruby.

searchReadTimeout
type: integer
default:
Optional

Same as requestTimeout but applies only to search operations.

Only available for the following languages: php, python, ruby.

requestTimeout
type: integer
default:
Optional

HTTP timeout for the request.

Only available for the following languages: ruby, android, swift, scala.

Response

No response

Did you find this page helpful?