ES to Pinecone Transfer Pipeline
A Python package for transferring documents from Elasticsearch to Pinecone with threading support for faster operations.
Features
- Transfer documents from Elasticsearch to Pinecone with minimal configuration
- Support for multiple embedding providers (OpenAI, HuggingFace)
- Multi-threaded processing for faster operations
- Configurable batch sizes and field selection
- Progress tracking with tqdm
- Comprehensive error handling
Installation
pip install es-to-pinecone-transfer
Quick Start
-
Create a
.envfile with your configuration (see.env.examplefor reference) -
Use the pipeline directly in your code:
from es_to_pinecone_transfer.pipeline import ElasticsearchToPineconePipeline
# Initialize and run the pipeline
pipeline = ElasticsearchToPineconePipeline()
pipeline.run()
- Or use the command-line interface:
es-to-pinecone
Configuration
The pipeline can be configured using environment variables. Here are the key settings:
Elasticsearch Configuration
ES_HOST: Elasticsearch host URLES_USERNAME: Elasticsearch username (optional)ES_PASSWORD: Elasticsearch password (optional)ES_API_KEY: Elasticsearch API key (optional, preferred over username/password)ES_INDEX: Source index name
Embedding Configuration
EMBEDDING_TYPE: Type of embedding to use (openai/huggingface/custom)OPENAI_API_KEY: OpenAI API key (if using OpenAI embeddings)OPENAI_MODEL: OpenAI model to use for embeddingsHUGGINGFACE_MODEL: HuggingFace model to use (if using HuggingFace)
Pinecone Configuration
PINECONE_API_KEY: Pinecone API keyPINECONE_ENVIRONMENT: Pinecone environmentPINECONE_INDEX_NAME: Target Pinecone index name
Pipeline Configuration
BATCH_SIZE: Number of documents to process in each batchMAX_THREADS: Maximum number of threads to useFIELDS_TO_EMBED: Comma-separated list of fields to embed from ES documentsMETADATA_FIELDS: Comma-separated list of fields to include as metadataDEFAULT_NAMESPACE: Pinecone namespace to use
Advanced Usage
Custom Field Mapping
from es_to_pinecone_transfer.pipeline import ElasticsearchToPineconePipeline
pipeline = ElasticsearchToPineconePipeline()
pipeline.set_field_mapping({
'title': 'headline',
'content': 'body',
'author': 'writer',
'timestamp': 'date'
})
pipeline.run()
Progress Callbacks
def on_batch_complete(batch_number, total_batches):
print(f"Completed batch {batch_number} of {total_batches}")
pipeline = ElasticsearchToPineconePipeline()
pipeline.set_progress_callback(on_batch_complete)
pipeline.run()
Error Handling
The pipeline provides comprehensive error handling:
try:
pipeline = ElasticsearchToPineconePipeline()
pipeline.run()
except ElasticsearchConnectionError as e:
print(f"Elasticsearch connection failed: {e}")
except PineconeConnectionError as e:
print(f"Pinecone connection failed: {e}")
except EmbeddingError as e:
print(f"Embedding generation failed: {e}")
except Exception as e:
print(f"Unexpected error: {e}")
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for es-to-pinecone-transfer 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| es_to_pinecone_transfer-0.1.0.tar.gz | 18.1 kB | Without provenance | Details for es_to_pinecone_transfer-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| es_to_pinecone_transfer-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for es_to_pinecone_transfer-0.1.0-py3-none-any.whl |
Total release size: 39.5 kB
Release files / es_to_pinecone_transfer-0.1.0.tar.gz
| Download URL | es_to_pinecone_transfer-0.1.0.tar.gz |
|---|---|
| Size | 18.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e26f32c15bb40dfbccb5d1e961691a44784171f696ce66b11ffea972f0314454
|
|
BLAKE2b-256 checksum How to use checksums |
dde66d95fd3272352655a42098080ee5c628fa44296ca3d3ade447993e74e17f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.6
|
Release files / es_to_pinecone_transfer-0.1.0-py3-none-any.whl
| Download URL | es_to_pinecone_transfer-0.1.0-py3-none-any.whl |
|---|---|
| Size | 21.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
de712f33095ab398101416c89b069d836f2b01ef8122cb536f15668877583b19
|
|
BLAKE2b-256 checksum How to use checksums |
73f27f3cec20ffa79e53ea53f1364f2bf98ec8e9e43981e7a0c3c8a762273697
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.6
|
Security for es-to-pinecone-transfer 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.