Your Zapfeed project has been successfully migrated from TiDB Serverless to Elasticsearch to participate in the AI Accelerate Hackathon (Elastic Challenge).
BEFORE:
- TiDB Serverless with vector search
- Vector embeddings stored in MySQL tables
- Direct SQL vector distance queries
AFTER:
- Standard MySQL database (via Prisma)
- Elasticsearch for vector search and hybrid search
- Enhanced search capabilities with keyword + semantic search
# Run the automated installer
node scripts/install-dependencies.js
# Or manually:
npm install @elastic/elasticsearch@^8.11.0
npm uninstall @tidbcloud/prisma-adapter @tidbcloud/serverless# Generate new Prisma client (vector fields removed)
npx prisma generate
# Create migration (if needed)
npx prisma migrate dev --name remove-embedded-documentsUpdate your .env file with Elasticsearch configuration:
# Option 1: Elastic Cloud (Recommended for hackathon)
ELASTICSEARCH_CLOUD_ID=your_cloud_id_here
ELASTICSEARCH_API_KEY=your_api_key_here
# Option 2: Self-hosted
ELASTICSEARCH_URL=http://localhost:9200
ELASTICSEARCH_USERNAME=elastic
ELASTICSEARCH_PASSWORD=your_password- Go to https://cloud.elastic.co/
- Create a free account (14-day trial)
- Create a new deployment
- Copy your Cloud ID and create an API Key
- Add them to your
.envfile
- Standard Prisma client connection
- No more TiDB adapters
- Vector storage and search
- Hybrid search (keyword + semantic)
- Auto-index creation
- Team-based filtering
app/api/chat/route.ts- Uses hybrid search for RAGapp/api/feedback/collect/route.ts- Stores embeddings in Elasticsearch- All routes now use standard MySQL connection
- Hybrid Search: Combines keyword and vector search
- Google Cloud Integration: Works with Vertex AI/Gemini embeddings
- Conversational AI: Enhanced RAG with better search results
- Agent-based Solution: Smart feedback analysis system
- Better Search Relevance: Hybrid scoring algorithms
- Real-time Indexing: Immediate search availability
- Scalable Architecture: Elasticsearch clustering support
- Rich Analytics: Built-in aggregations and metrics
npm run dev- Go to your feedback collection page
- Submit some feedback
- Check if embeddings are being indexed in Elasticsearch
- Go to the chat interface
- Ask questions about feedback
- Verify hybrid search is working (should find relevant context)
# Check Elasticsearch connection
curl -X GET "localhost:9200/_cluster/health?pretty"
# Check index creation
curl -X GET "localhost:9200/zapfeed-documents/_mapping?pretty"
# Search documents
curl -X GET "localhost:9200/zapfeed-documents/_search?pretty"Solution: Run npm install @elastic/elasticsearch@^8.11.0
Solutions:
- Check your
ELASTICSEARCH_CLOUD_IDandELASTICSEARCH_API_KEY - Verify network connectivity
- Try the self-hosted option with Docker:
docker run -d --name elasticsearch -p 9200:9200 -e "discovery.type=single-node" -e "xpack.security.enabled=false" docker.elastic.co/elasticsearch/elasticsearch:8.11.0
Solution:
npx prisma generate --force
npx prisma migrate reset # ⚠️ This deletes data- Intelligent Search: Show how hybrid search finds relevant feedback better than basic keyword search
- Google Cloud AI Integration: Demonstrate Gemini embeddings working with Elasticsearch
- Real-time Analytics: Show immediate feedback processing and searchability
- Conversational Interface: Highlight the AI chat that understands context
- Faster Search: Elasticsearch optimized for search workloads
- Better Relevance: Hybrid scoring combines semantic and keyword matching
- Scalability: Can handle millions of documents
- Cost Efficiency: No TiDB costs, Gemini free tier usage
- Deploy to Production: Use Elastic Cloud for hosting
- Add More Features:
- Aggregation queries for analytics
- Real-time feedback monitoring
- Advanced search filters
- Optimize Performance: Fine-tune search parameters
- Monitor Usage: Set up Elasticsearch monitoring
- Innovation: Novel hybrid search for feedback analysis
- Technical Excellence: Proper Elasticsearch integration with Google Cloud AI
- User Experience: Enhanced search and chat capabilities
- Business Impact: Better feedback insights for businesses
- Use of Partner Technology: Full Elasticsearch feature utilization
Good luck with your hackathon submission! 🚀