govuk-chat-opensearch: Example workflows
Below are some example workflows for how you might use snapshots for testing.
Restoring a previously-captured frozen instance snapshot
This might happen when you want to do some evaluation against a snapshot you've previously captured from the test OpenSearch instance.
1. Restore the frozen snapshot
Find the snapshot from the frozen instance repository (it'll be one in the list under the "Repository: govuk-chat-frozen-snapshots" heading):
uv run snapshot.py list
Note the snapshot name and the index name it contains, let's say the snapshot is called "govuk_chat_chunked_content_titan-2025-01-01-1200" and the index "govuk_chat_chunked_content_titan".
Restore the snapshot, specifying a new index called govuk_chat_chunked_content_titan_2025_05_05. You can call this index whatever you like; putting a date on it helps everyone identify when the index was created.
uv run snapshot.py restore govuk-chat-frozen-snapshots govuk_chat_chunked_content_titan-2025-01-01-1200 govuk_chat_chunked_content_titan govuk_chat_chunked_content_titan_2025_05_05
List the indices in the test cluster, wait for the "govuk_chat_chunked_content_titan_2025_05_05" to show "health: green". This will take a little while.
uv run snapshot.py list-indices
2. Do your testing against the new index
Use the test environment OpenSearch credentials and target the govuk_chat_chunked_content_titan_2025_05_05 index.
3. Delete the index
Indices are expensive, so it’s good practice to clean up after yourself and delete the index once you’re done.
uv run snapshot.py delete-index govuk_chat_chunked_content_titan_2025_05_05
Restoring a snapshot from production
This might happen when you want to do some evaluation against the current state of the production OpenSearch index (i.e. current live GOV.UK content), for which a snapshot is automatically created every night.
1. Restore the production snapshot to the test environment instance
Find the snapshot from the production cluster (it'll be the one from the govuk-production repository):
uv run snapshot.py list
Note the snapshot name and the index name it contains, let's say it's called "govuk_chat_chunked_content_default".
Restore the snapshot into the frozen instance, specifying a new index called yesterdays_production_index.
Note that we're restoring a snapshot from the govuk-production repository here, as we're making a copy of the GOV.UK production index into our test OpenSearch instance.
uv run snapshot.py restore govuk-production "2025-11-2701:12:02-chat-opensearch" govuk_chat_chunked_content_default yesterdays_production_index
List the indices in the test cluster, wait for the "yesterdays_production_index" to show "health: green". This will take a little while.
uv run snapshot.py list-indices
2. Do your testing against the new index
Use the test environment OpenSearch credentials and target the yesterdays_production_index index.
3. Delete the index
Indices are expensive, so it’s good practice to clean up after yourself and delete the index once you’re done.
uv run snapshot.py delete-index yesterdays_production_index