{"id":23661,"library":"elasticsearch5","title":"Elasticsearch Python Client (5.x)","description":"The official Python client for Elasticsearch version 5.x. This library is in maintenance mode and should not be used with newer Elasticsearch versions. Current version is 5.5.6, with no active development. Users should upgrade to the elasticsearch library (7.x/8.x) for compatibility with modern Elasticsearch clusters.","status":"maintenance","version":"5.5.6","language":"python","source_language":"en","source_url":"https://github.com/elastic/elasticsearch-py","tags":["elasticsearch","client","5.x","maintenance"],"install":[{"cmd":"pip install elasticsearch==5.5.6","lang":"bash","label":"Pin version for Elasticsearch 5.x"},{"cmd":"pip install elasticsearch5","lang":"bash","label":"Install latest from PyPI (may be older)"}],"dependencies":[{"reason":"Required for HTTP connection pooling and SSL handling.","package":"urllib3","optional":true},{"reason":"Used for Python 2/3 compatibility.","package":"six","optional":true}],"imports":[{"note":"The package name on PyPI is elasticsearch, not elasticsearch5. 'elasticsearch5' is only the wheel name for version 5.x.","wrong":"from elasticsearch5 import Elasticsearch","symbol":"Elasticsearch","correct":"from elasticsearch import Elasticsearch"}],"quickstart":{"code":"from elasticsearch import Elasticsearch\n\n# Connect to Elasticsearch (assuming default localhost:9200)\nes = Elasticsearch()\n\n# Index a document\nres = es.index(index=\"test-index\", id=1, body={\"name\": \"John Doe\", \"age\": 30})\nprint(res['result'])\n\n# Search for documents\nres = es.search(index=\"test-index\", body={\"query\": {\"match\": {\"name\": \"John\"}}})\nprint(res['hits']['hits'])","lang":"python","description":"Connect to a local Elasticsearch 5.x instance, index a document, and perform a basic search."},"warnings":[{"fix":"Upgrade to the elasticsearch-py library version 6.x, 7.x, or 8.x matching your Elasticsearch version.","message":"This client is only compatible with Elasticsearch 5.x. Using it with Elasticsearch 6.x or later will cause serialization errors and unexpected behavior.","severity":"breaking","affected_versions":"all"},{"fix":"Always pass 'conflicts='proceed'' in delete/update_by_query calls to avoid unexpected failures.","message":"The 'delete_by_query' and 'update_by_query' APIs now require the 'conflicts' parameter to be explicitly set. If not provided, the default behaviour differs from earlier versions.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Migrate to Python 3 to use newer client versions.","message":"Support for Python 2.7 is deprecated in this version. Future versions (>=6.0) require Python 3.","severity":"deprecated","affected_versions":"5.5.x"},{"fix":"Set 'timeout' and 'max_retries' on the connection class manually, or upgrade to >=6.0.","message":"The 'timeout' parameter for connections is in seconds but default is long (10 seconds). Errors may appear as connection timeouts on slow networks. Unlike later versions, 5.x does not support 'max_retries' for connection failures.","severity":"gotcha","affected_versions":"all 5.x"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Remove any 'include_type_name' parameter. Elasticsearch 5.x always uses mapping types.","cause":"A parameter from a newer Elasticsearch version was passed to a 5.x cluster.","error":"elasticsearch.exceptions.ElasticsearchException: TransportError(400, 'illegal_argument_exception', 'request [PUT /test-index] contains unrecognized parameter: [include_type_name]')"},{"fix":"Uninstall all elasticsearch packages, then run 'pip install elasticsearch==5.5.6' to get the official library.","cause":"The package is not properly installed or imported. pip may have installed a different package with the same name.","error":"AttributeError: module 'elasticsearch' has no attribute 'Elasticsearch'"},{"fix":"Use 'Elasticsearch([host], verify_certs=False, ssl_show_warn=False)' for development. For production, configure proper SSL.","cause":"Network proxy or SSL issues. In 5.x, SSL is not enabled by default; self-signed certificates cause errors.","error":"elasticsearch.exceptions.ConnectionError: ConnectionError(('Connection aborted.', OSError(0, 'Error'))) caused by: OSError(0, 'Error')"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}