Command Line Interface

CLI commands

app

app Usage: python3 -m app [OPTIONS] COMMAND [ARGS]... ╭─ Options ────────────────────────────────────────────────────────────────────╮ --install-completionInstall completion for the current shell. --show-completionShow completion for the current shell, to copy it or customize the installation.              --helpShow this message and exit. ╰──────────────────────────────────────────────────────────────────────────────╯ ╭─ Commands ───────────────────────────────────────────────────────────────────╮ import                Import data into Elasticsearch.                      import-taxonomies     Import taxonomies into Elasticsearch.                sync-scripts          Synchronize scripts defined in configuration with    Elasticsearch.                                       cleanup-indexes       Clean old indexes that are not active anymore (no    aliases)                                             run-update-daemon     Run the daemon responsible for listening to document updates from Redis                                   Stream and updating the Elasticsearch index.         export-openapi        Export OpenAPI specification to a file.              export-config-schema  Export Configuration json schema to a file.          export-settings-schemaExport Configuration json schema to a file.          ╰──────────────────────────────────────────────────────────────────────────────╯

import

import Usage: python3 -m app import [OPTIONS] {input_path} Import data into Elasticsearch. This command is used to initialize or refresh your index with data. File must contains one JSON document per line, each document must have same format as a document returned by the API. ╭─ Arguments ──────────────────────────────────────────────────────────────────╮ *input_path<file>Path of the JSONL data file[required] ╰──────────────────────────────────────────────────────────────────────────────╯ ╭─ Options ────────────────────────────────────────────────────────────────────╮ --skip-updates--no-skip-updatesSkip fetching fresh records  from redis                   [default: no-skip-updates]   --partial--no-partialOnly run a partial update,   on current index while the   default run a full import in a new index.                 Use this if instead of       re-importing the whole data, you only want to update the  data that has changed.       You will loose the           *rollback* capability in     case of failure.             [default: no-partial]        --num-processes<int>How many import processes to run in parallel              [default: 2]                 --num-items<int>How many items to import     (mainly for testing)         --config-path<file>path of the yaml             configuration file, it       overrides CONFIG_PATH envvar --index-id<str>Each index has its own       configuration in the         configuration file, and the  ID is used to know which     index to use. If there is    only one index, this option  is not needed.               --helpShow this message and exit. ╰──────────────────────────────────────────────────────────────────────────────╯

import-taxonomies

import-taxonomies Usage: python3 -m app import-taxonomies [OPTIONS] Import taxonomies into Elasticsearch. It download taxonomies json files as specified in the configuration file. It creates taxonomies indexes (for auto-completion). It creates synonyms files for ElasticSearch analyzers (enabling full text search to benefits from synonyms). ╭─ Options ────────────────────────────────────────────────────────────────────╮ --config-path<file>path of the yaml            configuration file, it      overrides CONFIG_PATH       envvar                      --index-id<str>Each index has its own      configuration in the        configuration file, and the ID is used to know which    index to use. If there is   only one index, this option is not needed.              --skip-indexing--no-skip-indexingSkip putting taxonomies in  the ES index                [default: no-skip-indexing] --skip-synonyms--no-skip-synonymsSkip creating synonyms      files for ES analyzers      [default: no-skip-synonyms] --helpShow this message and exit. ╰──────────────────────────────────────────────────────────────────────────────╯

sync-scripts

sync-scripts Usage: python3 -m app sync-scripts [OPTIONS] Synchronize scripts defined in configuration with Elasticsearch. This command must be run after adding, modifying or removing scripts. ╭─ Options ────────────────────────────────────────────────────────────────────╮ --config-path<file>path of the yaml configuration file, it         overrides CONFIG_PATH envvar                    --index-id<str>Each index has its own configuration in the     configuration file, and the ID is used to know  which index to use. If there is only one index, this option is not needed.                      --helpShow this message and exit. ╰──────────────────────────────────────────────────────────────────────────────╯

cleanup-indexes

cleanup-indexes Usage: python3 -m app cleanup-indexes [OPTIONS] Clean old indexes that are not active anymore (no aliases) As you do full import of data or update taxonomies, old indexes are not removed automatically. (in the case you want to roll back or compare). This command will remove all indexes that are not active anymore. ╭─ Options ────────────────────────────────────────────────────────────────────╮ --config-path<file>path of the yaml configuration file, it         overrides CONFIG_PATH envvar                    --index-id<str>Each index has its own configuration in the     configuration file, and the ID is used to know  which index to use. If there is only one index, this option is not needed. If not specified,    all indexes are cleaned                         --helpShow this message and exit. ╰──────────────────────────────────────────────────────────────────────────────╯

run-update-daemon

run-update-daemon Usage: python3 -m app run-update-daemon [OPTIONS] Run the daemon responsible for listening to document updates from Redis Stream and updating the Elasticsearch index. This command must be run in a separate process to the api server. It is optional but enables having an always up-to-date index, for applications where data changes. ╭─ Options ────────────────────────────────────────────────────────────────────╮ --config-path<file>path of the yaml configuration file, it         overrides CONFIG_PATH envvar                    --helpShow this message and exit. ╰──────────────────────────────────────────────────────────────────────────────╯

export-openapi

export-openapi Usage: python3 -m app export-openapi [OPTIONS] {target_path} Export OpenAPI specification to a file. ╭─ Arguments ──────────────────────────────────────────────────────────────────╮ *target_path<file>Path of the YAML or JSON data file[required] ╰──────────────────────────────────────────────────────────────────────────────╯ ╭─ Options ────────────────────────────────────────────────────────────────────╮ --helpShow this message and exit. ╰──────────────────────────────────────────────────────────────────────────────╯

export-config-schema

export-config-schema Usage: python3 -m app export-config-schema [OPTIONS] {target_path} Export Configuration json schema to a file. ╭─ Arguments ──────────────────────────────────────────────────────────────────╮ *target_path<file>Path of the YAML or JSON data file[required] ╰──────────────────────────────────────────────────────────────────────────────╯ ╭─ Options ────────────────────────────────────────────────────────────────────╮ --helpShow this message and exit. ╰──────────────────────────────────────────────────────────────────────────────╯

export-settings-schema

export-settings-schema Usage: python3 -m app export-settings-schema [OPTIONS] {target_path} Export Configuration json schema to a file. ╭─ Arguments ──────────────────────────────────────────────────────────────────╮ *target_path<file>Path of the YAML or JSON data file[required] ╰──────────────────────────────────────────────────────────────────────────────╯ ╭─ Options ────────────────────────────────────────────────────────────────────╮ --helpShow this message and exit. ╰──────────────────────────────────────────────────────────────────────────────╯

CLI Implementation

This module provides different commands to help setting up search-a-licious or doing maintenance operations.

app.cli.main.cleanup_indexes(config_path: ~pathlib.Path | None = <typer.models.OptionInfo object>, index_id: str | None = <typer.models.OptionInfo object>)[source]

Clean old indexes that are not active anymore (no aliases)

As you do full import of data or update taxonomies, old indexes are not removed automatically. (in the case you want to roll back or compare).

This command will remove all indexes that are not active anymore.

app.cli.main.export_config_schema(target_path: ~pathlib.Path = <typer.models.ArgumentInfo object>)[source]

Export Configuration json schema to a file.

app.cli.main.export_openapi(target_path: ~pathlib.Path = <typer.models.ArgumentInfo object>)[source]

Export OpenAPI specification to a file.

app.cli.main.export_schema(class_: type[Config] | type[Settings], target_path: Path)[source]

Export schema to a file.

app.cli.main.export_settings_schema(target_path: ~pathlib.Path = <typer.models.ArgumentInfo object>)[source]

Export Configuration json schema to a file.

app.cli.main.import_data(input_path: ~pathlib.Path = <typer.models.ArgumentInfo object>, skip_updates: bool = <typer.models.OptionInfo object>, partial: bool = <typer.models.OptionInfo object>, num_processes: int = <typer.models.OptionInfo object>, num_items: int | None = <typer.models.OptionInfo object>, config_path: ~pathlib.Path | None = <typer.models.OptionInfo object>, index_id: str | None = <typer.models.OptionInfo object>)[source]

Import data into Elasticsearch.

This command is used to initialize or refresh your index with data.

File must contains one JSON document per line, each document must have same format as a document returned by the API.

app.cli.main.import_taxonomies(config_path: ~pathlib.Path | None = <typer.models.OptionInfo object>, index_id: str | None = <typer.models.OptionInfo object>, skip_indexing: bool = <typer.models.OptionInfo object>, skip_synonyms: bool = <typer.models.OptionInfo object>)[source]

Import taxonomies into Elasticsearch.

It download taxonomies json files as specified in the configuration file.

It creates taxonomies indexes (for auto-completion).

It creates synonyms files for ElasticSearch analyzers (enabling full text search to benefits from synonyms).

app.cli.main.run_update_daemon(config_path: ~pathlib.Path | None = <typer.models.OptionInfo object>)[source]

Run the daemon responsible for listening to document updates from Redis Stream and updating the Elasticsearch index.

This command must be run in a separate process to the api server.

It is optional but enables having an always up-to-date index, for applications where data changes.

app.cli.main.sync_scripts(config_path: ~pathlib.Path | None = <typer.models.OptionInfo object>, index_id: str | None = <typer.models.OptionInfo object>)[source]

Synchronize scripts defined in configuration with Elasticsearch.

This command must be run after adding, modifying or removing scripts.