Registry / database / elasticsearch6

elasticsearch6

JSON →
library6.8.2pypypi✓ verified 84d ago

The `elasticsearch6` library is the official low-level Python client for Elasticsearch, specifically designed for compatibility with Elasticsearch 6.x servers. It provides a foundation for interacting with Elasticsearch, focusing on being opinion-free and highly extendable. While the main `elasticsearch` client has progressed to newer major versions (e.g., 9.x), `elasticsearch6` remains available on PyPI to support applications tied to Elasticsearch 6.x. It was last released in March 2021.

pip install elasticsearch6
INSTALL
IMPORT
SIG · ELASTICSEARCH6
E
elasticsearch6
databasepythonv6.8.2
Install
1.7s avg
Import
Disk
18MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v6.8.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.6MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.7s · import 0.000s · 20MB
18MB installed
● package 18MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Elasticsearch
from elasticsearch6 import Elasticsearch
from elasticsearch import Elasticsearch

This quickstart demonstrates how to connect to an Elasticsearch 6.x instance, create an index, index a document, retrieve it, perform a basic search, and delete the index. Note the explicit use of `doc_type` which is mandatory for Elasticsearch 6.x.

from datetime import datetime from elasticsearch import Elasticsearch import os # By default, connects to localhost:9200. # Ensure an Elasticsearch 6.x instance is running or specify host/port. # For local testing, you might run Elasticsearch via Docker, e.g.: # docker run -p 9200:9200 -e "discovery.type=single-node" -e "xpack.security.enabled=false" docker.elastic.co/elasticsearch/elasticsearch:6.8.23 # Configure connection. Use environment variables for production credentials. # Example for basic auth (if security is enabled on ES 6.x): # ELASTIC_HOST = os.environ.get('ELASTIC_HOST', 'http://localhost:9200') # ELASTIC_USER = os.environ.get('ELASTIC_USER', 'elastic') # ELASTIC_PASSWORD = os.environ.get('ELASTIC_PASSWORD', 'changeme') # es = Elasticsearch( # [ELASTIC_HOST], # http_auth=(ELASTIC_USER, ELASTIC_PASSWORD), # verify_certs=False, # Use with caution for self-signed or development certs # ) es = Elasticsearch('http://localhost:9200') # Connects to a local ES instance without security if not es.ping(): raise ValueError("Connection to Elasticsearch failed!") print("Connected to Elasticsearch!") index_name = 'my_test_index_6' doc_type_name = 'my_document_type' # Required in ES 6.x # Create an index (ignore 400 if it already exists) es.indices.create(index=index_name, ignore=400) # Index a document doc = { 'author': 'kimchy', 'text': 'Elasticsearch 6.x is stable.', 'timestamp': datetime.now() } res = es.index(index=index_name, doc_type=doc_type_name, id=1, body=doc) print(f"Indexed document ID 1: {res['result']}") # Get a document res = es.get(index=index_name, doc_type=doc_type_name, id=1) print(f"Retrieved document: {res['_source']}") # Search for documents res = es.search(index=index_name, doc_type=doc_type_name, body={ "query": {"match": {"author": "kimchy"}} }) print(f"Found {res['hits']['total']['value']} hits:") for hit in res['hits']['hits']: print(f" {hit['_source']['author']}: {hit['_source']['text']}") # Delete the index es.indices.delete(index=index_name, ignore=[400, 404]) print(f"Index '{index_name}' deleted.")
Debug
Known issues
breakingThe `_doc_type` parameter is mandatory for indexing and searching in Elasticsearch 6.x. Migrating to Elasticsearch 7.x or later servers (and their corresponding Python clients) will deprecate and eventually remove the `_doc_type` concept, requiring changes to API calls.
fix
Ensure `doc_type` is always provided when using `elasticsearch6` client. When migrating to newer Elasticsearch clients (v7+), refactor code to use typeless endpoints (e.g., `_doc` instead of `_doc_type`) and update API calls as per the target Elasticsearch server version's documentation.
affects: All versions of elasticsearch6 client (when interacting with Elasticsearch server versions 7.x+)
deprecatedElasticsearch 6.x deprecated the use of the `_version` field and similar metadata fields in certain contexts, which were fully removed in Elasticsearch 7.x. Using `elasticsearch6` client against an Elasticsearch 6.x server may still generate deprecation warnings if these features are utilized.
fix
Review Elasticsearch server deprecation logs (using `_cluster/settings?include_defaults=true` or the Deprecation Info API) for warnings about `_version` or other deprecated functionalities. Plan to refactor usage of these fields when considering an upgrade to Elasticsearch 7.x or later.
affects: All versions of elasticsearch6 client (when interacting with Elasticsearch 6.x server, if deprecated features are used)
gotchaConnecting to Elasticsearch 6.x requires careful attention to security settings. By default, recent Elasticsearch versions have security enabled. If connecting to a secure cluster without proper `http_auth`, `api_key`, or `ca_certs` configuration, `SSLError` or `AuthenticationException` will occur.
fix
For secure clusters, provide `http_auth=(username, password)` or `api_key` in the `Elasticsearch` client constructor. Ensure `ca_certs` is configured correctly if using TLS/SSL. For development, `verify_certs=False` can be used (with caution), or `xpack.security.enabled: false` can be set in `elasticsearch.yml` on the server side (not recommended for production).
affects: All versions of elasticsearch6 client
Upgrade
Version history
6.8.2latest on PyPI · released Mar 9, 2021
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
1
Resources
elasticsearch6 — pip install elasticsearch6 · libregistry