资讯动态

Elasticsearch:Jina Reader

发布时间:2026/10/19 1:31:28 来源:尧图企业网站定制
从网页和文档中提取可用文本比看起来更具挑战性。HTML 页面将有意义的内容与布局元素、脚本、广告和样式规则混合在一起而 PDF 文件则围绕打印逻辑进行结构化而非自然的文本流。如果没有可靠的方法来解析这些格式即使是简单的提取也可能变得不一致且难以自动化。Reader 通过像浏览器一样精确渲染源内容然后从完全解析后的文档中提取文本来解决这个问题。这种方法避免了猜测并能在各种真实世界的网站和文件中生成稳定的输出。Jina Reader 服务提供两个 endpoints分别提供不同的服务r.jina.ai通过 https://r.jina.ai/ 将任何 URL 转换为 LLM-ready text为你的 agents 和 RAG 系统生成更干净、更可靠的输入。s.jina.ai通过 https://s.jina.ai/yourquery 对任意查询执行实时 web search使你的 LLMs 能够从整个 web 获取最新信息。这两个 endpoints 结合在一起为开发者提供了一种简单、可靠的方式只需一次请求就能将复杂的 HTML 或 PDF 源转换为干净的 Markdown 或结构良好的 JSON使 Reader 成为任何数据摄取或处理 pipeline 的实用基础。https://github.com/liu-xiao-guo/jina_reader快速开始为了快速了解 Reader你可以直接使用任何 internet browser而无需编写任何代码或配置 API key。HTML → Markdown打开 https://www.elastic.co/elasticsearch 。你应该会看到 Elasticsearch 产品页面截图截至 2025 年 11 月 17 日。现在通过 Reader 打开同一个页面只需在 URL 前加上 r.jina.aihttps://r.jina.ai/https://www.elastic.co/elasticsearchReader 会返回一个以Markdown格式表示页面内容的纯文本响应。通过 r.jina.ai 在浏览器中直接访问 Reader 是一种方便的实验方式。免费、未认证的使用是有速率限制的并且对某些 URL 可能会受到限制。对于生产环境或更高优先级的工作流你应该使用带 API key 的认证 API。你可以在 Jina Reader API 网站获取一个 API key并在下一节所示的请求头中插入它。使用 Reader将页面转换为 Markdown使用 Reader 的最简单方式是将一个 URL 传给 https://r.jina.ai/ 并使用任何可访问互联网的工具保存输出。使用 curlcurl https://r.jina.ai/https://www.elastic.co/elasticsearch \ -o elasticsearch.md这里标志和参数-o elasticsearch.md会把结果写入一个名为elasticsearch.md的本地文件。使用 wgetwget \ --headerX-Return-Format: markdown \ -O elasticsearch.md \ https://r.jina.ai/https://www.elastic.co/elasticsearch参数-O elasticsearch.md会把结果写入指定的文件。使用 Pythonimport requests headers { X-Return-Format: markdown, } response requests.get( https://r.jina.ai/https://www.elastic.co/elasticsearch, headersheaders, ) print(response.text)这段代码会把结果打印到屏幕上。我们还提供一个交互式界面让你可以尝试不同的参数设置并自动生成其他编程语言的示例代码。认证使用和输出模式如果你需要更高优先级的访问和更少的限制请在 Authorization header 中包含你的 Jina API key将下面示例中的 YOUR_API_KEY 替换为你的 key并且可以通过 X-Return-Format 可选地指定明确的输出模式。使用 curlcurl https://r.jina.ai/https://www.elastic.co/elasticsearch \ -H Authorization: Bearer YOUR_API_KEY \ -H X-Return-Format: markdown \ -o elasticsearch.md使用 wgetwget \ --headerAuthorization: Bearer YOUR_API_KEY \ --headerX-Return-Format: markdown \ -O elasticsearch.md \ https://r.jina.ai/https://www.elastic.co/elasticsearch使用Pythonimport requests headers { Authorization: Bearer YOUR_API_KEY, X-Return-Format: markdown, } response requests.get( https://r.jina.ai/https://www.elastic.co/elasticsearch, headersheaders, ) print(response.text)JSON 模式在生产环境中你可能更希望将 Reader 的输出包装成一个 JSON 对象这样更容易解析。要在 r.jina.ai 上启用 JSON 模式请添加请求头 Accept: application/json。例如在 Python 中headers { Authorization: Bearer YOUR_API_KEY, X-Return-Format: markdown, Accept: application/json, }对于 curl使用标志-H Authorization: Bearer YOUR_API_KEY对于 wget使用--headerAuthorization: Bearer YOUR_API_KEY如上例所示将 header 添加到请求中。生成的 JSON 输出核心部分如下所示{ code: 200, status: 20000, data: { title: ..., description: ..., url: https://www.elastic.co/elasticsearch, content: ... } }有关通过 r.jina.ai 提供的服务的更多信息请访问 Reader API 文档页面。使用 s.jina.ai 搜索Reader —— 通过 https://s.jina.ai API —— 执行 web search你提供一个 query它会处理来自搜索引擎的结果。它提供的服务是标准化SERPsSearch Engine Results Page即你在 Google 或其他搜索引擎搜索时得到的结果页面。SERP 通常包含一组带有 snippets、预览文本和小型 metadata 字段的链接但直接提取很困难因为页面通常还包含广告以及可选服务或其他产品的链接。使用方法很简单只需检索以下 URL并替换为你自己的查询词https://s.jina.ai/your search query将查询词之间的空格替换为 “”如下面的示例所示https://s.jina.ai/ElasticJinaAIReader API 会在 Google 上执行你的搜索并将结果处理成结构化的 Markdown 页面其中包含前 10 个匹配项的页面标题、URL以及底层搜索引擎提供的描述/摘要。默认情况下它还会尝试抓取网页并将其转换为 Markdown使用与上述 HTML/PDF 转 Markdown 转换器相同的模型但请求可能因超时或其他原因失败因此页面可能不存在。与所有 Reader API 服务一样如果你使用 Jina API key你将获得更高优先级因此可以更快地获得结果无流量限制也不会因流量过大而被拒绝请求。一个具体示例curl https://s.jina.ai/ElasticJina -H Authorization: Bearer YOUR_API_KEY这会返回 Markdown 格式的文本看起来如下[1] Title: Elastic and Jina AI join forces to advance open source retrieval for AI ... [1] URL Source: https://www.elastic.co/blog/elastic-jina-ai [1] Description: We are thrilled to announce that Elastic has joined forces with Jina AI, a pioneer in open source multimodal and multilingual embeddings, ... [1] Date: Oct 9, 2025 [2] Title: Elastic Completes Acquisition of Jina AI, a Leader in Frontier Models for Multimodal and Multilingual Search [2] URL Source: https://ir.elastic.co/news/news-details/2025/Elastic-Completes-Acquisition-of-Jina-AI-a-Leader-in-Frontier-Models-for-Multimodal-and-Multilingual-Search/default.aspx [2] Description: Acquisition advances Elastic’s leadership in retrieval, embeddings, and context engineering to power agentic AI Elastic (NYSE: ESTC), the Search AI Company, has completed the acquisition of Jina AI , a pioneer in open source multimodal and multilingual embeddings, reranker, and small language models. The acquisition deepens Elastic’s capabilities in vector search, retrieval-augmented generation (RAG), and context engineering, further strengthening the company’s position as the leading Search AI Platform for developers and enterprises. Elastic’s addition of Jina AI demonstrates its continued commitment to delivering open, accessible, and production-ready Search AI at scale. “Search is the foundation of generative AI,” said Ash Kulkarni, CEO, Elastic . “Jina AI’s team and technology bring cutting-edge models into the Elastic ecosystem, making our platform even more powerful for context engineering. Together, we are expanding what developers and enterprises can achieve with [2] Date: Oct 9, 2025 ### Elastic Completes Acquisition of Jina AI, a Leader in Frontier Models for Multimodal and Multilingual Search _Acquisition advances Elastic’s leadership in retrieval, embeddings, and context engineering to power agentic AI_你可以仅执行搜索而不尝试获取底层页面只需添加请求头X-Respond-With: no-content。例如curl https://s.jina.ai/ElasticJina \ -H Authorization: Bearer YOUR_API_KEY \ -H X-Respond-With: no-content这会返回以 Markdown 格式表示的文本开头如下[1] Title: Elastic and Jina AI join forces to advance open source retrieval for AI ... [1] URL Source: https://www.elastic.co/blog/elastic-jina-ai [1] Description: We are thrilled to announce that Elastic has joined forces with Jina AI, a pioneer in open source multimodal and multilingual embeddings, ... [1] Date: Oct 9, 2025 [2] Title: Elastic Completes Acquisition of Jina AI, a Leader in Frontier Models ... [2] URL Source: https://ir.elastic.co/news/news-details/2025/Elastic-Completes-Acquisition-of-Jina-AI-a-Leader-in-Frontier-Models-for-Multimodal-and-Multilingual-Search/default.aspx [2] Description: The acquisition of Jina AI broadens Elastics leadership in relevance for unstructured data by adding dense vector, multilingual and multimodal ... [2] Date: Oct 9, 2025 [3] Title: Jina AI - Elasticsearch Labs [3] URL Source: https://www.elastic.co/search-labs/integrations/jina [3] Description: Jina AI is now part of Elastic, bringing its high-performance multilingual and multimodal search AI to Elasticsearchs powerful data storage, retrieval, and ... [4] Title: Elastic Completes Acquisition of Jina AI, a Leader in Frontier Models ... [4] URL Source: https://finance.yahoo.com/news/elastic-completes-acquisition-jina-ai-130200685.html [4] Description: Elastics addition of Jina AI demonstrates its continued commitment to delivering open, accessible, and production-ready Search AI at scale. [4] Date: Oct 9, 2025Reader 还提供结构化提取模式如果你添加请求头Accept: application/json它会返回 JSON 结构化数据。例如要执行与上面相同的搜索curl https://s.jina.ai/ElasticJina \ -H Authorization: Bearer YOUR_API_KEY \ -H Accept: application/json这会以 JSON 格式返回相同的信息方便其他应用程序访问同时还包括一些页面 metadata 和 token 使用摘要。下面的示例输出为了可读性和节省空间很多内容已被省略用...代替data: [ { title: Elastic Completes Acquisition of Jina AI, a Leader in Frontier Models for Multimodal and Multilingual Search, url: https://ir.elastic.co/news/news-details/2025/Elastic-Completes-Acquisition-of-Jina-AI-a-Leader-in-Frontier-Models-for-Multimodal-and-Multilingual-Search/default.aspx, description: Acquisition advances Elastic’s leadership ..., date: Oct 9, 2025, content: ### Elastic Completes Acquisition of Jina AI..., metadata: { lang: en-US, ... }, usage: { tokens: 1447 } }, { title: Elastic Completes Acquisition of Jina AI, a Leader in Frontier Models for Multimodal and Multilingual Search, url: https://finance.yahoo.com/news/elastic-completes-acquisition-jina-ai-130200685.html, ...这个 API 还有更多选项。欲了解完整信息包括可选参数及其对应的 headers请访问 Reader API 页面。Reader 与 ElasticsearchReader API 是一个方便的工具用于执行表面看似简单但实际上并不简单的任务。网络环境足够复杂你确实需要 AI 才能充分利用它。从网页和 PDF 中提取数据对程序员来说是一项杂乱的工作但非常适合 AI 语言模型。Reader 选择以 JSON 和 Markdown 作为标准格式这反映了支持最有用、广泛支持、同时又简单且人类可访问的数据格式的策略。你可以将 Markdown 直接放入 Elasticsearch 文档存储并使用 Elastic Document API 提供的任意方法进行索引。最佳策略通常是先使用 Reader 获取文档然后批量处理或者在资源受限时使用尽可能大的批次。你可以将 Reader 输出与任何文本存储或索引策略结合使用。Elasticsearch 在存储、索引和检索中对 JSON 提供直接支持。JSON 格式可供人工检查可作为纯文本传输并在所有主流编程语言和框架中有可靠支持同时在浏览器中也内置支持。Reader 通过将 AI 引入现实世界生成的杂乱数据使你的 Elastic 安装更有用。原文https://www.elastic.co/search-labs/tutorials/jina-tutorial/jina-reader

读完文章,也想定制专属网站?

尧图设计师 24 小时内与您沟通定制方案

免费获取报价 →
↑