Skip to main content

Solr to Elasticsearch Migrator

This will migrate a Solr node to an Elasticsearch index.

Requirements

  • Python 3+
    • elasticsearch
    • pysolr

Usage

usage: solr-to-es [-h] [--solr-query SOLR_QUERY] [--solr-fields COMMA_SEP_FIELDS]
                  [--rows-per-page ROWS_PER_PAGE] [--es-timeout ES_TIMEOUT]
                  solr_url elasticsearch_url elasticsearch_index doc_type

The following example will page through all documents on the local Solr, and submit them to the local Elasticsearch server in the index es_index with a document type of solr_docs.

solr-to-es http://localhost:8983/solr/<<collection_name>> http://localhost:9200 <<collection_name>> solr_docs

solr_url is the full url to your Solr,

elasticsearch_url is the url of your Elasticsearch server.

elasticsearch_index is the index you will submit the Solr documents to on Elasticsearch.

doc_type is the type of document Elasticsearch should assume you are importing.

--solr-query defaults to *:*

--solr-fields defaults to (i.e. all fields)

--rows-per-page defaults to 500

--es-timeout defaults to 60

--es-user for authentication in Elasticsearch

--es-password for authentication in Elasticsearch

--es-max-retries maximum number of times a document will be retried when 429 is received, set to 0 for no retries on 429

--es-initial-backoff number of seconds we should wait before the first retry. Any subsequent retries will be powers of initial_backoff * 2**retry_number

Install

Run python setup.py install to install the script.

Demo

Here is an example of grabbing the over 114 thousand journal articles from Plos.org API about animals.

docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch

solr-to-es --solr-query animal http://api.plos.org/search localhost:9200 es_plos solr_docs

curl http://localhost:9200/_cat/indices?v

Note: that you will get an 403 Forbidden error from the script, and that is because the solr.quepid.com doesn't allow deep paging, however you will have documents in your ES cluster.

Metadata

Release files for pds.solr-to-es 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for pds.solr-to-es 0.3.0
File Interpreter ABI Platform Actions
pds.solr_to_es-0.3.0-py3-none-any.whl Python 3 none any Details for pds.solr_to_es-0.3.0-py3-none-any.whl

Release files / pds.solr_to_es-0.3.0-py3-none-any.whl

Download URL pds.solr_to_es-0.3.0-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cfeea2e901876921ce43f0e0b17449c5095d90c8b1f156196060bc07944c09d4
BLAKE2b-256 checksum
How to use checksums
77d5e63532882cd7a57cd10db16ec3ebe7daf31f8a2d0454d4643799fa8d0fb3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Security for pds.solr-to-es 0.3.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.

Release history Release notifications | RSS feed

This release

0.3.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page