ProjectsParts Services
Critical Fixes Plan
> Date: 2026-01-23 > Priority: CRITICAL > Status: In Progress
Critical Fixes Plan
Date: 2026-01-23 Priority: CRITICAL Status: In Progress
Identified Issues
🔴 CRITICAL
| # | Issue | Impact |
|---|---|---|
| 1 | gcp-rebuild-dev-index.sh includes parts_kmt | Will return KMT to parts_current |
| 2 | ES mapping not applied to live indices | productType unavailable for filtering |
| 3 | Data without productType | Filtering doesn't work |
| 4 | Search API doesn't support productType | Frontend can't filter |
🟡 HIGH
| # | Issue | Impact |
|---|---|---|
| 5 | tires_current without productType | Search doesn't distinguish types |
| 6 | Frontend not updated | Catalog/tires show everything |
Fixes
Fix 1: gcp-rebuild-dev-index.sh (5 min)
# WAS:
SYNC_COLLECTIONS="parts_nhl,parts_bns,parts_vnt,parts_kmt,parts_kuh,..."
# SHOULD BE:
SYNC_COLLECTIONS="parts_nhl,parts_bns,parts_vnt,parts_kuh,parts_hot,parts_har,parts_mar,parts_kin,parts_mch"
# WITHOUT parts_kmt!Fix 2: Apply ES mapping (5 min)
# Add productType to both indices
gcloud compute ssh elasticsearch-vm --zone=us-east1-b --project=noted-bliss-466410-q6 --tunnel-through-iap \
--command="curl -X PUT 'localhost:9200/parts_current/_mapping' \
-H 'Content-Type: application/json' \
-d '{\"properties\":{\"productType\":{\"type\":\"keyword\"}}}'"
gcloud compute ssh elasticsearch-vm --zone=us-east1-b --project=noted-bliss-466410-q6 --tunnel-through-iap \
--command="curl -X PUT 'localhost:9200/tires_current/_mapping' \
-H 'Content-Type: application/json' \
-d '{\"properties\":{\"productType\":{\"type\":\"keyword\"}}}'"Fix 3: Update data with productType (5 min)
# parts_current → productType='part'
gcloud compute ssh elasticsearch-vm --zone=us-east1-b --project=noted-bliss-466410-q6 --tunnel-through-iap \
--command="curl -X POST 'localhost:9200/parts_current/_update_by_query?refresh=true' \
-H 'Content-Type: application/json' \
-d '{\"script\":{\"source\":\"ctx._source.productType = \\\"part\\\"\"},\"query\":{\"match_all\":{}}}'"
# tires_current → productType='tire'
gcloud compute ssh elasticsearch-vm --zone=us-east1-b --project=noted-bliss-466410-q6 --tunnel-through-iap \
--command="curl -X POST 'localhost:9200/tires_current/_update_by_query?refresh=true' \
-H 'Content-Type: application/json' \
-d '{\"script\":{\"source\":\"ctx._source.productType = \\\"tire\\\"\"},\"query\":{\"match_all\":{}}}'"Fix 4: Add productType to Search API (15 min)
4.1 schemas/search.ts
export const SearchQuerySchema = z.object({
// ... existing fields
productType: z.enum(['part', 'tire', 'accessory']).optional(),
});4.2 utils/query-builder.ts
// In buildSearchQuery():
if (params.productType) {
filters.push({ term: { productType: params.productType } });
}4.3 routes/search.ts
// Add productType to openapi schema and handlerFix 5: Create tires sync script (5 min)
# gcp-rebuild-tires-index.sh
SYNC_COLLECTIONS="parts_kmt"
SEARCH_INDEX_NAME="tires_current"Execution Order
- Fix 1: Fix gcp-rebuild-dev-index.sh (remove parts_kmt)
- Fix 2: Apply ES mapping
- Fix 3: Update data (update_by_query)
- Fix 4: Add productType to Search API
- Test: Verify filtering
- Fix 5: Create tires sync script (optional)
Testing After Fixes
# 1. Check mapping
curl -s "localhost:9200/parts_current/_mapping" | jq '.. | .productType? // empty'
# 2. Check data
curl -s "https://api.crop-dev.app/api/search?limit=1" | jq '.parts[0].productType'
# 3. Check filtering
curl -s "https://api.crop-dev.app/api/search?productType=part&limit=1" | jq '.pagination.total'
# Expected: 2594
curl -s "https://api.crop-dev.app/api/search?productType=tire&limit=1" | jq '.pagination.total'
# Expected: 7091 (after adding cross-index search)Risks
| Risk | Mitigation |
|---|---|
| update_by_query slow on large data | 2594 + 7091 = ~10K docs, should be fast |
| API downtime during deploy | Changes are backward-compatible |
| gcp script runs before fix | Fix it FIRST |
Media Coverage Dashboard - Design Reference
Version: 1.0.0 Last Updated: 2025-11-17 Purpose: UI/UX design guidelines for Media Coverage Admin Dashboard
Prometheus Metrics Documentation
This document describes all custom Prometheus metrics collected by the Search service for monitoring autocomplete quality, fitment coverage, and system health.