ProjectsParts Services
Dual-Index Architecture Fix Plan
Current Status - Parts Index: ✅ Working ( alias → ) - Tires Index: ❌ Broken (no alias, raw index created by sync)
Dual-Index Architecture Fix Plan
Current Status
- Parts Index: ✅ Working (
parts_currentalias →parts_v2026_01_20) - Tires Index: ❌ Broken (no alias, raw index created by sync)
Root Cause Analysis
Problem 1: Missing Tires Index Setup
The sync workflow writes directly to tires_current without first creating:
- A versioned index (
tires_v{timestamp}) - Proper aliases (
tires_current_read,tires_current_write)
Problem 2: Missing Environment Variable
Cloud Run deployment doesn't set TIRES_INDEX_NAME environment variable.
Problem 3: Incomplete Health Check
Health endpoint only monitors parts_current, not tires_current.
Fix Implementation
Step 1: Create Tires Index Setup Script
Create services/search/scripts/setup-tires-index.ts:
- Create
tires_v{timestamp}index with same mapping as parts - Create aliases:
tires_current_read,tires_current_write
Step 2: Update Workflow
Add step before tires sync:
- name: Create Tires index if needed
run: |
export SERVICE_IMAGE="${REGISTRY}/${PROJECT_ID}/${SERVICE_NAME}:${GITHUB_SHA}"
bash services/search/scripts/gcp-create-tires-index.shStep 3: Add Environment Variable
Update Cloud Run deploy step:
--set-env-vars="...@TIRES_INDEX_NAME=tires_current@..."Step 4: Update Health Endpoint
Modify /health to check both indices:
{
parts: { alias: "parts_current", target: "...", docs: N },
tires: { alias: "tires_current", target: "...", docs: N }
}Immediate Workaround
Run manually on ES cluster:
# 1. Create versioned index with mapping
PUT /tires_v2026_01_21
{
"settings": { ... },
"mappings": { ... }
}
# 2. Create aliases
POST /_aliases
{
"actions": [
{ "add": { "index": "tires_v2026_01_21", "alias": "tires_current_read" }},
{ "add": { "index": "tires_v2026_01_21", "alias": "tires_current_write" }},
{ "add": { "index": "tires_v2026_01_21", "alias": "tires_current" }}
]
}
# 3. Re-run tires syncFiles to Modify
services/search/scripts/setup-tires-index.ts- NEWservices/search/scripts/gcp-create-tires-index.sh- NEW.github/workflows/search-deploy.yml- Add tires index creation step.github/workflows/search-deploy.yml- Add TIRES_INDEX_NAME env varservices/search/src/routes/health.ts- Check both indicesservices/search/scripts/switch-alias-to-latest.ts- Ensure tires aliases exist
Testing Checklist
-
curl /healthshows both indices -
curl /api/search?category=tiresreturns 7091 results -
curl /api/filters?category=tiresreturns facets - Parts search still works (no regression)