sidon.dev

hybrid-search-rag.md · sidon.dev

Ingestion and hybrid search service for RAG (OpenSearch + Databricks)

Part of: Senior Developer · Backend & AI, Petrobras

A service I built from scratch inside a legacy Flask API. It provides ingestion and semantic search to every module of the corporate AI assistant platform.

  • I took a notebook prototype to production. The prototype pulled corporate data from Databricks (SQL Warehouse), generated embeddings and indexed them in OpenSearch. Before building the service, I proposed and documented a reusable architecture for connections, embeddings and search.
  • It ingests unstructured documents (pages/chunks and PDF) and structured data with a declarative schema that generates the index mapping dynamically.
  • Hybrid BM25 + k-NN search with RRF fusion (Search Pipeline) and result deduplication.
  • Natural-language search: the LLM extracts filters from the question, based on an allowed schema, and translates them into OpenSearch pre-filter clauses.
  • I diagnosed a recall problem (the k-NN candidate pool was tied to the result size) and documented the fix plan.
  • It was the first module in the repository with automated tests, including API security tests.
  • Python
  • Flask
  • OpenSearch
  • Databricks
  • Azure OpenAI (embeddings)
  • LangChain
  • Pytest