A developer extracts text and structured data from unstructured documents (PDFs, scanned images) using Bailian's document understanding, ingests the extracted content into Elasticsearch for indexing and retrieval, then deploys a fully functional RAG chatbot application on top of the Elasticsearch knowledge base — creating a complete pipeline from raw documents to a working AI-powered Q&A system.
Use this pipeline when you need to transform unstructured files (PDFs, scanned invoices, technical manuals) into a searchable, AI-powered Q&A system. Developers combine Bailian’s document understanding to extract and structure raw content, then leverage Elasticsearch for scalable vector indexing and retrieval, finally deploying a production-ready RAG chatbot without building custom retrieval infrastructure.
POST https://dashscope.aliyuncs.com/api/v1/services/aigc/document-extraction with model: "qvq-max" and parameters: {"enable_thinking": true, "output_format": "json"}.text_blocks and tables. Split into 512-token chunks with 10% overlap to preserve cross-page context.PUT /rag-knowledge-base { "mappings": { "properties": { "content": { "type": "text" }, "embedding": { "type": "dense_vector", "dims": 1024, "index": true, "similarity": "cosine" } } } }
text-embedding-v3. Push to ES using POST /_bulk with {"index": {"_index": "rag-knowledge-base", "refresh": "wait_for"}}. Maintain throughput ≤100 QPS to avoid cluster throttling.POST /_ml/rag/deploy with {"retrieval": {"type": "knn", "k": 5}, "llm_synthesis": {"model": "qwen-turbo", "prompt": "Answer using {context}"}}.POST /_ml/rag/query {"query": "Extract key terms", "top_k": 3} and verify citation grounding.Raw documents enter Bailian, which handles OCR, layout-aware parsing, and structured extraction. The output is chunked, embedded, and pushed to Elasticsearch, which manages dense-vector indexing, k-NN retrieval, and transactional refresh control. The RAG application orchestrates ES retrieval and LLM synthesis, returning grounded answers with source citations.
dashscope SDKelasticsearch clienttext-embedding-v3 defaults to 1024 dims; misaligning this with ES dense_vector.dims causes mapping errors.refresh: wait_for during bulk ingestion delays RAG visibility. Use explicit POST /_refresh before initial queries.429 failures.Q: How do I extract information from PDFs or scanned documents and deploy a RAG chatbot? A: You can complete this process by using Bailian's document understanding to extract text and structured data from PDFs or scanned images, ingesting the results into Elasticsearch for indexing, and deploying a RAG chatbot application on top of the knowledge base. This end-to-end pipeline automatically converts raw unstructured documents into a fully functional AI-powered Q&A system.