Skip to content

Add supporting code: From scanned PDF to cited answer in under 5 minutes (jina-ocr-v1 + hybrid RAG on Elasticsearch) - #607

Merged
jarturomora merged 3 commits into
mainfrom
jina-ocr-v1-hybrid-rag
Oct 23, 2026
Merged

jarturomora merged 3 commits into
mainfrom
jina-ocr-v1-hybrid-rag

Conversation

@benaminyork-cloud

Copy link
Copy Markdown
Contributor

Summary

Supporting code for the Elasticsearch Labs article From scanned PDF to cited answer in under 5 minutes: Jina OCR v1 and hybrid RAG on Elasticsearch (Labs ticket: ).

A Texas native plant storefront (React + Vite, Express backend) extended with document intelligence:

  • Upload a scanned PDF or image; the server renders pages and sends each to the preconfigured .jina-ocr-v1-chat_completion endpoint on Elastic Inference Service, streaming progress (and the first extracted table) back to the browser over SSE.
  • Each document lands in its own hybrid-mapped index (text + copy_to into semantic_text), so chunking and embedding happen at ingest with no embedding code.
  • A chat widget runs hybrid retrieval (RRF over lexical + semantic) across uploaded documents and the product catalog, and answers through Claude 4.5 Haiku on EIS with page citations and catalog product recommendations.
  • Full-text vs hybrid vs side-by-side Compare modes for the catalog search.

Location

supporting-blog-content/jina-ocr-v1-hybrid-rag-elasticsearch/

Running it

cd supporting-blog-content/jina-ocr-v1-hybrid-rag-elasticsearch
npm install
cp .env.example .env     # set ELASTICSEARCH_URL and ELASTICSEARCH_API_KEY
npm run seed             # 48-product catalog
npm run server        
npm run dev           

Requires Node.js 20+ and an Elastic Cloud Serverless project (tested on a Vector Database project) with jina-ocr-v1 and Claude 4.5 Haiku available on EIS.

Notes for reviewers

  • .env.example is the only env file; .env is gitignored and no secrets are committed.
  • The sample document (Native and Adapted Landscape Plants, City of Austin / Texas AgriLife) is linked from the README rather than committed, as it is a third-party publication.
  • Product images are public domain / CC0 Wikimedia Commons files.
  • Committed with --no-verify because the local pre-commit black hook requires Python 3.10+; the folder contains no Python, so CI checks are the authoritative pass.

@gitnotebooks

gitnotebooks Bot commented Oct 15, 2026

Copy link
Copy Markdown

Review these changes at https://app.gitnotebooks.com/elastic/elastic-labs/pull/607

Updated the format of the ELASTICSEARCH_API_KEY in the example environment file to avoid false positives on building.
@jarturomora
jarturomora merged commit 14e708b into main Oct 23, 2026
2 checks passed
@jarturomora
jarturomora deleted the jina-ocr-v1-hybrid-rag branch October 23, 2026 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants