Elasticsearch
ElasticsearchReader #
Bases: BasePydanticReader
Read documents from an Elasticsearch/Opensearch index.
These documents can then be used in a downstream Llama Index data structure.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
endpoint
|
str
|
URL (http/https) of cluster |
required |
index
|
str
|
Name of the index (required) |
required |
httpx_client_args
|
dict
|
Optional additional args to pass to the |
None
|
Source code in llama-index-integrations/readers/llama-index-readers-elasticsearch/llama_index/readers/elasticsearch/base.py
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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|
load_data #
load_data(field: str, query: Optional[dict] = None, embedding_field: Optional[str] = None) -> List[Document]
Read data from the Elasticsearch index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field
|
str
|
Field in the document to retrieve text from |
required |
query
|
Optional[dict]
|
Elasticsearch JSON query DSL object. For example: {"query": {"match": {"message": {"query": "this is a test"}}}} |
None
|
embedding_field
|
Optional[str]
|
If there are embeddings stored in this index, this field can be used to set the embedding field on the returned Document list. |
None
|
Returns:
Type | Description |
---|---|
List[Document]
|
List[Document]: A list of documents. |
Source code in llama-index-integrations/readers/llama-index-readers-elasticsearch/llama_index/readers/elasticsearch/base.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|