Skip to content

Search HQ CLI Guide

The search-hq command-line interface (CLI) allows you to manage and interact with the Search HQ application. Below is an overview of the available commands and their descriptions.

Getting Started

To get started with the search-hq CLI, run the following command to see an overview of available options and commands:

search-hq --help

This command will display a summary of the CLI usage, including available commands and options:

Usage: search-hq [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  deploy                   Deploy the complete Search HQ application.
  destroy                  Destroy the complete Search HQ application.
  hybrid-search            Operate Hybrid Search service.
  opensearch-auto-scaling  Operate OpenSearch Auto Scaling service.
  opensearch-gateway       Operate OpenSearch API Gateway service.
  resources                List CloudFormation stack resources.
  status                   List CloudFormation stack statuses.

Download Configurations

Deploy Application

Manage the Complete Application

Use the search-hq deploy command to deploy the entire Search HQ application, including all services and infrastructure. This encompasses:

  • Application Infrastructure: Sets up the foundational infrastructure for the application.
  • OpenSearch Auto Scaling service: Deploys auto scaling functionality for OpenSearch to handle varying loads.
  • Search API Service: Deploys the API Gateway service for managing search operations.
  • Hybrid Search service: Deploys the SageMaker service for advanced embedding inference.

To execute the deployment process, use the following command:

search-hq deploy [OPTIONS]
Option Type Required Description
auto_approve Boolean Optional Automatically approve all prompts during deployment without manual confirmation. Default is True.
model_overwrite Boolean Optional Overwrite the existing model artifact in the Amazon S3 bucket if it already exists. Default is False.

If you want to deploy individual services separately, use the following commands:

Manage the Hybrid Search service

To get detailed usage instructions for managing the Hybrid Search service, including embedding model deployment and semantic index schema generation, run:

search-hq hybrid-search --help

For comprehensive documentation on Hybrid Search commands, please see the Hybrid Search CLI Guide.

Manage OpenSearch Auto Scaling service

To get detailed usage instructions for managing the OpenSearch Auto Scaling service, including deployment and destruction, run:

search-hq opensearch-auto-scaling --help

For comprehensive documentation on OpenSearch Auto Scaling commands, please see the OpenSearch Auto Scaling CLI Guide.

Manage the OpenSearch API Gateway service

To get detailed usage instructions for managing the OpenSearch API Gateway service, including deployment, destruction, and retrieval of API information, run:

search-hq opensearch-gateway --help

For comprehensive documentation on OpenSearch API Gateway commands, please see the OpenSearch API Gateway CLI Guide.

List CloudFormation Stack Resources

The search-hq resources command lists the resources for CloudFormation stacks. This is useful for reviewing the components that have been deployed, including infrastructure, services, and other resources managed by the application.

To list resources for all CloudFormation stacks, use:

search-hq resources

To list resources for particular CloudFormation stacks, use:

search-hq resources <STACK_NAMES>

Replace <STACK_NAMES> with the names of the stacks you want to query.

Display CloudFormation Stack Statuses

Use the search-hq status command to display the statuses of CloudFormation stacks, including current status, creation time, and last updated time.

To list the statuses of all CloudFormation stacks, use:

search-hq status

To list the statuses of specific CloudFormation stacks, use:

search-hq status <STACK_NAMES>

Replace <STACK_NAMES> with the names of the stacks you want to query.

Destroy Application

Destroy the Full Search HQ

Use the search-hq destroy command to remove the entire Search HQ application and all associated resources. This command performs a comprehensive cleanup of the following components:

  1. OpenSearch Auto Scaling service: Removes the auto scaling functionality for OpenSearch.
  2. OpenSearch API Gateway service: Deletes the API Gateway service managing search operations.
  3. SageMaker Inference Service: Destroys the SageMaker service used for advanced embedding inference.
  4. Application Infrastructure: Cleans up the foundational infrastructure set up for the application.

To execute the destruction process, use the following command:

search-hq destroy [OPTIONS]
Option Type Required Description
auto_approve Boolean Optional Automatically approve all prompts during destruction without manual confirmation. Default is True.

If you need to destroy individual services separately, use the following commands:

Destroy the OpenSearch Auto Scaling service

To get detailed usage instructions for destroying the OpenSearch Auto Scaling service, including specific options and commands, run:

search-hq opensearch-auto-scaling destroy --help

For comprehensive documentation on OpenSearch Auto Scaling commands, please see the OpenSearch Auto Scaling CLI Guide.

Destroy the OpenSearch API Gateway service

To get detailed usage instructions for destroying the OpenSearch API Gateway service, including specific options and commands, run:

search-hq opensearch-gateway destroy --help

For comprehensive documentation on OpenSearch API Gateway commands, please see the OpenSearch API Gateway CLI Guide.

Destroys the SageMaker Inference Service

To get detailed usage instructions for destroying the SageMaker inference service, including specific options and commands, run:

search-hq hybrid-search destroy-model --help

For comprehensive documentation on Hybrid Search commands, please see the Hybrid Search CLI Guide.

Remove Associated Resources

By default, the destroy command will retain the Amazon S3 bucket and AWS Systems Manager Parameter Store associated with your search-hq deployment. You can choose to manually delete these resources if needed.

  • Remove Objects from Amazon S3 Bucket: To delete the entire Amazon S3 bucket associated with your search-hq deployment, use the following command. This will remove the entire bucket and all objects within it:

    python -m operation.cli.s3 delete_bucket
    

    If you only need to delete a single object from the Amazon S3 bucket, use:

    python -m operation.cli.s3 delete_object --key <S3_OBJECT_KEY>
    

    Replace <S3_OBJECT_KEY> with the key of the object you want to delete from the Amazon S3 bucket.

  • Remove Parameters from SSM: To delete all parameters associated with your search-hq deployment from AWS Systems Manager Parameter Store, use:

    python -m operation.cli.ssm delete_ssm_parameters
    

    If you only need to delete a single parameter, use:

    python -m operation.cli.ssm delete_ssm_parameter --parameter_name <PARAMETER_NAME>
    

    Replace <PARAMETER_NAME> with the name of the parameter you want to delete from the AWS Systems Manager Parameter Store.