Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

docs: translate Elasticsearch search engine documentation from Chinese to English

not-lucky84ce0a64452b
diff --git a/docs/elasticsearch_search_engine.md b/docs/elasticsearch_search_engine.md
index c7e181651a..1a22368dc8 100644
--- a/docs/elasticsearch_search_engine.md
+++ b/docs/elasticsearch_search_engine.md
@@ -1,123 +1,123 @@
-# Elasticsearch 搜索引擎
+# Elasticsearch Search Engine
-这个文档介绍如何在 Local Deep Research 项目中使用和配置 Elasticsearch 搜索引擎。
+This document describes how to use and configure the Elasticsearch search engine within the Local Deep Research project.
-## 概述
+## Overview
-Elasticsearch 搜索引擎允许你搜索 Elasticsearch 索引中的文档。这对于需要搜索大量结构化或非结构化文本数据的场景非常有用。
+The Elasticsearch search engine allows you to search for documents within Elasticsearch indices. This is particularly useful for scenarios requiring searches across large volumes of structured or unstructured text data.
-## 前提条件
+## Prerequisites
-1. 运行中的 Elasticsearch 服务器(本地或远程)
-2. Elasticsearch Python 客户端库:`elasticsearch>=8.10.0`
+1. A running Elasticsearch server (local or remote).
+2. Elasticsearch Python client library: `elasticsearch>=8.10.0`.
-## 安装
+## Installation
-确保你已经安装了 `elasticsearch` Python 包。如果你是从源代码安装 Local Deep Research,可以运行:
+Ensure that you have installed the `elasticsearch` Python package. If you are installing Local Deep Research from source, you can run:
```bash
pip install elasticsearch>=8.10.0
```
-## 基本用法
+## Basic Usage
-### 在代码中使用
+### Usage in Code
```python
from local_deep_research.web_search_engines.engines.search_engine_elasticsearch import ElasticsearchSearchEngine
-# 创建搜索引擎实例
+# Create search engine instance
es_search = ElasticsearchSearchEngine(
- hosts=["http://localhost:9200"], # Elasticsearch 服务器地址
- index_name="my_index", # 要搜索的索引名称
- username="user", # 可选:认证用户名
- password="pass", # 可选:认证密码
- max_results=10 # 返回结果数量
+ hosts=["http://localhost:9200"], # List of Elasticsearch hosts
+ index_name="my_index", # Name of the index to search
+ username="user", # Optional: Authentication username
+ password="pass", # Optional: Authentication password
+ max_results=10 # Maximum number of results to return
)
-# 执行搜索
-results = es_search.run("你的搜索查询")
+# Execute search
+results = es_search.run("Your search query")
-# 处理结果
+# Process results
for result in results:
- print(f"标题: {result.get('title')}")
- print(f"片段: {result.get('snippet')}")
- print(f"内容: {result.get('content')}")
+ print(f"Title: {result.get('title')}")
+ print(f"Snippet: {result.get('snippet')}")
+ print(f"Content: {result.get('content')}")
```
-### 高级搜索
+### Advanced Search
-ES搜索引擎支持多种高级搜索方式:
+The ES search engine supports various advanced search methods:
```python
-# 使用 Elasticsearch 查询字符串语法
-results = es_search.search_by_query_string("title:关键词 AND content:内容")
+# Use Elasticsearch Query String syntax
+results = es_search.search_by_query_string("title:keyword AND content:search_text")
-# 使用 Elasticsearch DSL(领域特定语言)
+# Use Elasticsearch DSL (Domain Specific Language)
results = es_search.search_by_dsl({
"query": {
"bool": {
- "must": {"match": {"content": "搜索词"}},
- "filter": {"term": {"category": "技术"}}
+ "must": {"match": {"content": "search term"}},
+ "filter": {"term": {"category": "technology"}}
}
}
})
```
-## 配置说明
+## Configuration
-### 搜索引擎参数
+### Search Engine Parameters
-| 参数 | 类型 | 默认值 | 说明 |
-|------|------|--------|------|
-| hosts | List[str] | ["http://localhost:9200"] | Elasticsearch 服务器地址列表 |
-| index_name | str | "documents" | 要搜索的索引名称 |
-| username | Optional[str] | None | 认证用户名 |
-| password | Optional[str] | None | 认证密码 |
-| api_key | Optional[str] | None | API 密钥认证 |
+| Parameter | Type | Default Value | Description |
+| :--- | :--- | :--- | :--- |
+| hosts | List[str] | ["http://localhost:9200"] | List of Elasticsearch server addresses |
+| index_name | str | "documents" | Name of the index to search |
+| username | Optional[str] | None | Authentication username |
+| password | Optional[str] | None | Authentication password |
+| api_key | Optional[str] | None | API Key authentication |
| cloud_id | Optional[str] | None | Elastic Cloud ID |
-| max_results | int | 10 | 最大结果数 |
-| highlight_fields | List[str] | ["content", "title"] | 要高亮显示的字段 |
-| search_fields | List[str] | ["content", "title"] | 要搜索的字段 |
-| filter_query | Optional[Dict] | None | 可选的过滤查询 |
-| llm | Optional[BaseLLM] | None | 用于相关性过滤的语言模型 |
-| max_filtered_results | Optional[int] | None | 过滤后的最大结果数 |
+| max_results | int | 10 | Maximum number of results |
+| highlight_fields | List[str] | ["content", "title"] | Fields to highlight |
+| search_fields | List[str] | ["content", "title"] | Fields to search |
+| filter_query | Optional[Dict] | None | Optional filter query |
+| llm | Optional[BaseLLM] | None | LLM for relevance filtering |
+| max_filtered_results | Optional[int] | None | Maximum number of filtered results |
-## 索引数据
+## Indexing Data
-为了便于使用,我们提供了 `ElasticsearchManager` 工具类来帮助索引数据:
+For ease of use, we provide the `ElasticsearchManager` utility class to help index data:
```python
from local_deep_research.utilities.es_utils import ElasticsearchManager
-# 创建 ES 管理器
+# Create ES Manager
es_manager = ElasticsearchManager(
hosts=["http://localhost:9200"]
)
-# 创建索引
+# Create index
es_manager.create_index("my_index")
-# 索引单个文档
+# Index a single document
es_manager.index_document(
index_name="my_index",
document={
- "title": "文档标题",
- "content": "文档内容...",
+ "title": "Document Title",
+ "content": "Document content...",
}
)
-# 批量索引文档
+# Bulk index documents
documents = [
- {"title": "文档1", "content": "内容1"},
- {"title": "文档2", "content": "内容2"}
+ {"title": "Document 1", "content": "Content 1"},
+ {"title": "Document 2", "content": "Content 2"}
]
es_manager.bulk_index_documents("my_index", documents)
-# 索引文件(自动提取内容)
+# Index file (automatically extract content)
es_manager.index_file("my_index", "path/to/document.pdf")
-# 索引整个目录中的文件
+# Index all files in a directory
es_manager.index_directory(
"my_index",
"path/to/docs",
@@ -125,30 +125,30 @@ es_manager.index_directory(
)
```
-## 示例
+## Examples
-查看 `examples/elasticsearch_search_example.py` 获取完整的使用示例。
+Refer to `examples/elasticsearch_search_example.py` for a complete usage example.
-## 运行示例
+## Running Examples
-确保 Elasticsearch 正在运行,然后执行:
+Ensure Elasticsearch is running, then execute:
```bash
python examples/elasticsearch_search_example.py
```
-## 故障排除
+## Troubleshooting
-### 无法连接到 Elasticsearch
+### Cannot connect to Elasticsearch
-- 确保 Elasticsearch 服务器正在运行
-- 检查主机地址和端口是否正确
-- 验证认证凭据(如果需要)
-- 检查网络连接和防火墙设置
+- Ensure the Elasticsearch server is running.
+- Verify the host address and port.
+- Verify authentication credentials (if required).
+- Check network connection and firewall settings.
-### 搜索结果为空
+### Empty Search Results
-- 确保索引存在并且包含数据
-- 检查搜索字段是否正确
-- 尝试使用更简单的查询
-- 检查 Elasticsearch 日志获取更多信息
+- Ensure the index exists and contains data.
+- Check if the search fields are correct.
+- Try using a simpler query.
+- Check Elasticsearch logs for more information.
\ No newline at end of file