Skip to main content
Prompts FastAPI Elasticsearch Multi-Search Project Builder

model coding template risk: low

FastAPI Elasticsearch Multi-Search Project Builder

Act as a proficient software developer to build a comprehensive Elasticsearch search project using FastAPI, supporting keyword, semantic, and vector search methods. Implement data…

PROMPT

Act as a proficient software developer. You are tasked with building a comprehensive Elasticsearch search project using FastAPI. Your project should:

- Support various search methods: keyword, semantic, and vector search.
- Implement data splitting and importing functionalities for efficient data management.
- Include mechanisms to synchronize data from PostgreSQL to Elasticsearch.
- Design the system to be extensible, allowing for future integration with Kafka.

Responsibilities:
- Use FastAPI to create a robust and efficient API for search functionalities.
- Ensure Elasticsearch is optimized for various search queries (keyword, semantic, vector).
- Develop a data pipeline that handles data splitting and imports seamlessly.
- Implement synchronization features that keep Elasticsearch in sync with PostgreSQL databases.
- Plan and document potential integration points for Kafka to transport data.

Rules:
- Adhere to best practices in API development and Elasticsearch usage.
- Maintain code quality and documentation for future scalability.
- Consider performance impacts and optimize accordingly.

Use variables such as:
- ${searchMethod:keyword} to specify the type of search.
- ${databaseType:PostgreSQL} for database selection.
- ${integration:kafka} to indicate future integration plans.

INPUTS

searchMethod

to specify the type of search

e.g. keyword

databaseType

for database selection

e.g. PostgreSQL

integration

to indicate future integration plans

e.g. kafka

ROLES & RULES

Role assignments

  • Act as a proficient software developer.
  1. Adhere to best practices in API development and Elasticsearch usage.
  2. Maintain code quality and documentation for future scalability.
  3. Consider performance impacts and optimize accordingly.

EXPECTED OUTPUT

Format
code
Constraints
  • adhere to best practices in API development and Elasticsearch usage
  • maintain code quality and documentation
  • consider performance impacts and optimize accordingly

SUCCESS CRITERIA

  • Support various search methods: keyword, semantic, and vector search.
  • Implement data splitting and importing functionalities for efficient data management.
  • Include mechanisms to synchronize data from PostgreSQL to Elasticsearch.
  • Design the system to be extensible, allowing for future integration with Kafka.
  • Use FastAPI to create a robust and efficient API for search functionalities.
  • Ensure Elasticsearch is optimized for various search queries.
  • Develop a data pipeline that handles data splitting and imports seamlessly.
  • Implement synchronization features that keep Elasticsearch in sync with PostgreSQL databases.
  • Plan and document potential integration points for Kafka.

FAILURE MODES

  • May not fully implement all specified search methods.
  • Could overlook detailed synchronization logic between PostgreSQL and Elasticsearch.
  • Might insufficiently document Kafka integration points.
  • Risk of suboptimal Elasticsearch query optimization.

CAVEATS

Missing context
  • PostgreSQL table schemas
  • Embedding model/service for vector/semantic search
  • Authentication and security requirements
  • Project folder structure and file organization
Ambiguities
  • Does not specify data schemas or sample data for PostgreSQL and Elasticsearch indexing.
  • Unclear exact API endpoints and request/response formats for search methods.
  • No details on embedding models or providers for semantic and vector search.

QUALITY

OVERALL
0.70
CLARITY
0.85
SPECIFICITY
0.65
REUSABILITY
0.85
COMPLETENESS
0.55

IMPROVEMENT SUGGESTIONS

  • Specify exact API endpoints with request/response schemas (e.g., POST /search with query params).
  • Provide sample PostgreSQL schema and data for testing the pipeline.
  • Detail the embedding strategy (e.g., OpenAI, HuggingFace model).
  • Add constraints on performance metrics or scalability targets.

USAGE

Copy the prompt above and paste it into your AI of choice — Claude, ChatGPT, Gemini, or anywhere else you're working. Replace any placeholder sections with your own context, then ask for the output.

MORE FOR MODEL