OpenSearch Data Migration

This recipe will demonstrate how to migrate from OpenSearch to Redis using the RIOT-X elastic-import command.

Prerequisites

  1. RIOT-X installed.

  2. Docker

OpenSearch setup

The following steps are from the OpenSearch quickstart.

  1. Start a OpenSearch instance

    docker run -d -p 9200:9200 -p 9600:9600 -e "discovery.type=single-node" -e "DISABLE_SECURITY_PLUGIN=true" opensearchproject/opensearch:latest
  2. Verify OpenSearch started successfully

    curl http://localhost:9200

    You should get a response like this:

    {
      "name" : "e1d4a3b076d7",
      "cluster_name" : "docker-cluster",
      "cluster_uuid" : "I-l10-7HSs2LGyZsZyZDGw",
      "version" : {
        "distribution" : "opensearch",
        "number" : "3.2.0",
        "build_type" : "tar",
        "build_hash" : "6adc0bf476e1624190564d7fbe4aba00ccf49ad8",
        "build_date" : "2025-08-12T03:54:07.457522696Z",
        "build_snapshot" : false,
        "lucene_version" : "10.2.2",
        "minimum_wire_compatibility_version" : "2.19.0",
        "minimum_index_compatibility_version" : "2.0.0"
      },
      "tagline" : "The OpenSearch Project: https://opensearch.org/"
    }
  3. Define sample index fields

    curl -O https://raw.githubusercontent.com/opensearch-project/documentation-website/3.2/assets/examples/ecommerce-field_mappings.json
    curl -H "Content-Type: application/json" -X PUT "http://localhost:9200/ecommerce" --data-binary "@ecommerce-field_mappings.json"
  4. Upload documents to the index

    curl -O https://raw.githubusercontent.com/opensearch-project/documentation-website/3.2/assets/examples/ecommerce.ndjson
    curl -H "Content-Type: application/x-ndjson" -X PUT "http://localhost:9200/ecommerce/_bulk" --data-binary "@ecommerce.ndjson"

Data Import

To import from OpenSearch to Redis run the following command:

riotx elastic-import ecommerce --opensearch --elastic-host http://localhost:9200 json.set ecommerce:#{customer_id}
For detailed configuration options and advanced features, see the Elasticsearch documentation.