Skip to main content

CLI app for Solr

Project description

Solar

This CLI tool provides help with some routine Solr operations:

  • Import / Export data
  • Import / Export configs
  • Re-index Collection (WIP)

Usage

Export

Export data

This command will save docs from <collection> to local folder ./data:

solar -c "<collection>" "https://<username>:<password>@localhost:8333" export ./data

Export nested documents

Solr can handle nested documents. To see nested structure of collection usually we add fl="*, [child]" to our query params. Solar can handle exporting nested documents by adding --nested flag:

solar -c "<collection>" "https://<username>:<password>@localhost:8333" export --nested ./data

Export config

If we want to save collection config, we can user export-config command:

solar -c "<collection>" "https://<username>:<password>@localhost:8333" export-config ./configs

This will all config files to local folder ./configs

Import

Import data

Later, we can import previously exported data with import command, and ./data/<collection>.json as source file:

solar "https://<username>:<password>@localhost:8333" export ./data/<collection>.json

We do not have to specify collection name, source .json already have collection name. However, if we want to import data as collection with different name, we can set this with -c flag:

solar -c "<new collection name>" "https://<username>:<password>@localhost:8333" export ./data/<collection>.json

Import config

Solar can help you import configsets to your Solr instance:

solar -c "https://<username>:<password>@localhost:8333" import-config <config folder path>

This command will read files from provide config path, zip them, and send to Solr. By default, created config name will be equal to config folder name. For example, if we import config from ./configs/products, Solar will create config named products.

If we want to override default name, we can use --name flag:

solar -c "https://<username>:<password>@localhost:8333" import-config --name "product-v2" <config folder path>

This will create config product-v2.

Also, we can overwrite existing config with --overwrite flag

This flag will add cleanup=true and overwrite=true params to request for creating config. However it is recommended to create config with the new name, because in some cases, Solr caches fields types, and some changes of new config will not be applied. Goog practice is version control your configs and name them with version identifier (commit hash, for example) Using this flag also requires that no collections is linked to this config

solar -c "https://<username>:<password>@localhost:8333" import-config --overwrite <config folder path>

Other

Remove config

Config <config name> can be removed from Solr with this command:

solar -c "https://<username>:<password>@localhost:8333" remove-config "<config name>"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

solar-cli-0.1.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

solar_cli-0.1.0-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file solar-cli-0.1.0.tar.gz.

File metadata

  • Download URL: solar-cli-0.1.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.1 CPython/3.10.6 Windows/10

File hashes

Hashes for solar-cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 88d2c22ac15a809c5ce4792db3152b9f4fda8ab897099b2b7befb95dee9bb9c3
MD5 b085eadbe51e679badac96f8193bdaba
BLAKE2b-256 fb998b9a6cb4fca7ea5b860a7dc782a2d8b565caf6a8765ffbc180401df6b257

See more details on using hashes here.

File details

Details for the file solar_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: solar_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.1 CPython/3.10.6 Windows/10

File hashes

Hashes for solar_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fdbae94f91c97ede35a5bfc7e94c6b02789d77c207eefdb8dc316c0e468a48c8
MD5 837adadf1930fa7cf5fb128cb71edb67
BLAKE2b-256 964ad4a36a2bb5afb77cb101423d01d19b40dd49fb3f4a715c4c768ef1c0e62f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page