Forking writes between indexes
Background
Writes to one index should also be written to one or more other indexes.
Preferred: Admin API (new-style index_aliases.doc_writes)
Use the admin API alias endpoints. The source index is auto-included on the first call.
# Add target index to write fan-out
curl -X POST ".../api/v1/admin/accounts/{account}/indexes/{source_index}/aliases/write-targets" \
-d '{"targetIndexId": "{account}-{target_index}"}'
To disable fan-out without losing config: PATCH .../aliases/write-enabled with {"enabled": false}.
See Aliasing design doc for full API reference and validation rules.
Legacy: Direct DDB edit (add_docs_config.index_write_aliases)
If the admin API is unavailable, edit DDB directly.
- Collect the following information about each index (from
prod-EcomIndexSettingsTable):system_account_id: System account ID. Defaults to the same as the source.index_name: Name of the aliased index.shop_id: Shop ID of the aliased index ({system_account_id}-{index_name}).queue_url: SQS queue URL of the aliased index.s3_bucket: S3 bucket for docs to write to the aliased index (same for all indexes).s3_prefix: S3 prefix for docs to write to the aliased index ({shop_id}/).
- Edit ecommerce index settings, specifically
add_docs_config, to addindex_write_aliases.- ⚠️ When using write aliases, only write aliases are considered at runtime. To write to both
fooandbar, you need two write aliases — one for each.
- ⚠️ When using write aliases, only write aliases are considered at runtime. To write to both
- Once updated, you should see activity on the target index queues in SQS and jobs in the jobs list on the Admin UI.