BPC OpenSearch Tool
The BPC OpenSearch Tool command-line tool allows you to list, delete, export, and import OpenSearch indexes.
The executable file bpc-opensearch-tool.jar can be downloaded from the download page.
Features
The tool allows you to perform tasks that would otherwise require significant effort and be prone to errors if carried out via direct HTTP requests (e.g., using CURL).
The focus is on:
-
exporting indexes
-
importing indexes
-
correctly handling index and alias names during these processes
Usage
The tool currently supports the following four commands:
-
List indexes (
LIST) -
Delete index (
DELETE) -
Export index (
EXPORT) -
Import index (
IMPORT)
You can also access the help by entering java -jar bpc-opensearch-tool.jar --help.
Usage: bpc-opensearch-tool.jar [-hkV] [-f=<zipFile>] [-i=<indexName>]
[-p=<password>] [-u=<user>] [-U=<url>] <command>
Provides some tools to work with OpenSearch indices in the BPC way.
<command> The command to execute.
Valid values: LIST, DELETE, EXPORT, IMPORT
-f, --file=<zipFile> The name of the file to import (e.g required for
the IMPORT command).
-h, --help Show this help message and exit.
-i, --index=<indexName> The name of the index (e.g. required for the DELETE
AND EXPORT commands).
-k, --insecure Allow insecure connections to OpenSearch. Defaults
to 'false'.
-p, --password=<password> Password of the OpenSearch user.
-u, --user=<user> Name of the OpenSearch user.
-U, --url=<url> The URL to connect OpenSearch (e.g. https:
//localhost:9200).
-V, --version Print version information and exit.
List indexes (LIST)
The command LIST generates a tabular list of all indexes.
java -jar bpc-opensearch-tool.jar \
--url https://localhost:9200 --user=admin --password=admin --insecure \
LIST
Delete an index (DELETE)
The command DELETE deletes an index.
java -jar bpc-opensearch-tool.jar \
--url https://localhost:9200 --user=admin --password=admin --insecure \
DELETE --index=ein-index
Export an index (EXPORT)
The command EXPORT can be used to export an index as a ZIP archive.
This includes the index’s settings, mappings, and data.
Whenever possible, always specify the index’s alias.
This will then also be used as the name for the ZIP archive.
java -jar bpc-opensearch-tool.jar \
--url https://localhost:9200 --user=admin --password=admin --insecure \
EXPORT --index=ein-index
Importing an Index (IMPORT)
The command ` IMPORT ` restores the index from a ZIP archive export.
The name of the ZIP archive is used as the alias for the index (without the file extension).
java -jar bpc-opensearch-tool.jar \
--url https://localhost:9200 --user=admin --password=admin --insecure \
IMPORT --file=ein-index.zip