Bases: KVDocumentStore
Elasticsearch文档(节点)存储。
用于文档和节点对象的Elasticsearch存储。
Source code in llama_index/storage/docstore/elasticsearch/base.py
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47 | class ElasticsearchDocumentStore(KVDocumentStore):
"""Elasticsearch文档(节点)存储。
用于文档和节点对象的Elasticsearch存储。
Args:
elasticsearch_kvstore(ElasticsearchKVStore):Elasticsearch键值存储
namespace(str):docstore的命名空间"""
def __init__(
self,
elasticsearch_kvstore: ElasticsearchKVStore,
namespace: Optional[str] = None,
node_collection_index: str = None,
ref_doc_collection_index: str = None,
metadata_collection_index: str = None,
batch_size: int = DEFAULT_BATCH_SIZE,
) -> None:
"""初始化一个ElasticsearchDocumentStore。"""
super().__init__(
elasticsearch_kvstore, namespace=namespace, batch_size=batch_size
)
if node_collection_index:
self._node_collection = node_collection_index
else:
self._node_collection = f"llama_index-docstore.data-{self._namespace}"
if ref_doc_collection_index:
self._ref_doc_collection = ref_doc_collection_index
else:
self._ref_doc_collection = (
f"llama_index-docstore.ref_doc_info-{self._namespace}"
)
if metadata_collection_index:
self._metadata_collection = metadata_collection_index
else:
self._metadata_collection = (
f"llama_index-docstore.metadata-{self._namespace}"
)
|