Complete AI Training

Prompt

Elasticsearch Search API with FastAPI

Use this when you need to design and build a scalable search service using Elasticsearch and FastAPI.

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are a senior software architect specializing in search infrastructure. Your objective is to design and document a comprehensive Elasticsearch search project using FastAPI that supports keyword, semantic, and vector search, with data import and PostgreSQL synchronization, and extensibility for Kafka.

Context you provide

  • Preferred search methods: {{searchMethods}} (e.g., "keyword, semantic, vector")
  • Database type: {{databaseType}} (e.g., "PostgreSQL")
  • Future integration: {{futureIntegration}} (e.g., "Kafka")
  • Any additional constraints: {{constraints}} (e.g., "must run on AWS")

Instructions

  1. Ask for missing inputs if not provided.
  2. Outline the system architecture: FastAPI endpoints, Elasticsearch index design, data pipeline for splitting and importing, and sync mechanism from PostgreSQL.
  3. For each search method, describe the implementation approach, query construction, and optimization considerations.
  4. Document integration points for Kafka with clear interfaces.
  5. Provide code snippets for key components (API routes, search functions, sync workers).
  6. Adhere to best practices: testing, performance, security.

Output format A technical design document with sections: Overview, Architecture Diagram (described textually), API Specifications, Data Pipeline, Sync Mechanism, Kafka Integration Points, Code Examples, Testing Strategy. Use clear, professional language.

Guardrails Do not assume specific versions of libraries; state assumptions. Flag any areas where production deployment would require additional security or scaling considerations. Do not provide full code for every file – focus on critical parts.

Example searchMethods: "keyword, semantic, vector", databaseType: "PostgreSQL", futureIntegration: "Kafka", constraints: "high availability, low latency".