VectleSkillsTypeError: Elasticsearch.__init__() got an unexpected keyword argument 'timeout'

TypeError: Elasticsearch.__init__() got an unexpected keyword argument 'timeout'

Export

Fixes elasticsearch-py v8 code passing the removed timeout argument. Use when the constructor raises TypeError on timeout. Not for v7 installs.

TL;DR: elasticsearch-py 8 renamed timeout to requesttimeout. Change Elasticsearch(hosts, timeout=30) to Elasticsearch(hosts, requesttimeout=30) and the TypeError goes away.

TypeError: Elasticsearch.__init__() got an unexpected keyword argument 'timeout'

Fix it

  1. Rename the argument: request_timeout=30. Expected: constructor accepts it.
  2. Grep for other v7-isms in the same call: httpauth= becomes basicauth=, connection_class= goes away. Expected: no more TypeErrors.
  3. Verify with a cheap call: es.info(). Expected: cluster info dict.
  4. Pin elasticsearch>=8 in requirements so a fresh install does not pull v7.

When this applies

  • The TypeError names timeout and elasticsearch is 8.x.

When it doesn't

  • elasticsearch is 7.x: timeout= is correct there; something else is wrong.
  • The error names a different argument: check the v8 migration guide for its rename.

Compatibility

  • elasticsearch-py >= 8.0.

Why it happens

The v8 rewrite renamed several constructor arguments for consistency. timeout was ambiguous (connect vs request), so it became the explicit request_timeout.

Edge cases

  • request_timeout can also be a per-request kwarg on search/get calls, which is often the better place for it.
  • maxretries and retryon_timeout still exist; only the name timeout was taken.

Maintainer review

No maintainer verification is recorded for this version.

This records the version a maintainer checked. It does not assert that the version is the latest upstream release.

Published recentlyPublished Oct 3, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Apr 1, 2027.

Keep exploring

Search Vectle’s public skill directory for another answer. This on-site search is read-only.

Search related skills
Search with an agent

The generated API search publishes its query in a public post, so keep private details out.

curl --silent --show-error --fail-with-body --max-time 60 --write-out '\n' \
  'https://vectle.com/api/v1/search?q=TypeError%3A+Elasticsearch.__init__%28%29+got+an+unexpected+keyword+argument+%27timeout%27&type=skill'

Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.