Opensearch
OpensearchVectorStore #
Bases: BasePydanticVectorStore
Elasticsearch/Opensearch vector store.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client
|
OpensearchVectorClient
|
Vector index client to use for data insertion/querying. |
required |
Examples:
pip install llama-index-vector-stores-opensearch
from llama_index.vector_stores.opensearch import (
OpensearchVectorStore,
OpensearchVectorClient,
)
# http endpoint for your cluster (opensearch required for vector index usage)
endpoint = "http://localhost:9200"
# index to demonstrate the VectorStore impl
idx = "gpt-index-demo"
# OpensearchVectorClient stores text in this field by default
text_field = "content"
# OpensearchVectorClient stores embeddings in this field by default
embedding_field = "embedding"
# OpensearchVectorClient encapsulates logic for a
# single opensearch index with vector search enabled
client = OpensearchVectorClient(
endpoint, idx, 1536, embedding_field=embedding_field, text_field=text_field
)
# initialize vector store
vector_store = OpensearchVectorStore(client)
Source code in llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/llama_index/vector_stores/opensearch/base.py
884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 |
|
add #
add(nodes: List[BaseNode], **add_kwargs: Any) -> List[str]
Add nodes to index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nodes
|
List[BaseNode]
|
List[BaseNode]: list of nodes with embeddings. |
required |
Source code in llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/llama_index/vector_stores/opensearch/base.py
938 939 940 941 942 943 944 945 946 947 948 949 950 951 |
|
async_add
async
#
async_add(nodes: List[BaseNode], **add_kwargs: Any) -> List[str]
Async add nodes to index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nodes
|
List[BaseNode]
|
List[BaseNode]: list of nodes with embeddings. |
required |
Source code in llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/llama_index/vector_stores/opensearch/base.py
953 954 955 956 957 958 959 960 961 962 963 964 965 966 |
|
delete #
delete(ref_doc_id: str, **delete_kwargs: Any) -> None
Delete nodes using with ref_doc_id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ref_doc_id
|
str
|
The doc_id of the document to delete. |
required |
Source code in llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/llama_index/vector_stores/opensearch/base.py
968 969 970 971 972 973 974 975 976 |
|
adelete
async
#
adelete(ref_doc_id: str, **delete_kwargs: Any) -> None
Async delete nodes using with ref_doc_id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ref_doc_id
|
str
|
The doc_id of the document to delete. |
required |
Source code in llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/llama_index/vector_stores/opensearch/base.py
978 979 980 981 982 983 984 985 986 |
|
delete_nodes #
delete_nodes(node_ids: Optional[List[str]] = None, filters: Optional[MetadataFilters] = None, **delete_kwargs: Any) -> None
Deletes nodes async.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_ids
|
Optional[List[str]]
|
IDs of nodes to delete. Defaults to None. |
None
|
filters
|
Optional[MetadataFilters]
|
Metadata filters. Defaults to None. |
None
|
Source code in llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/llama_index/vector_stores/opensearch/base.py
988 989 990 991 992 993 994 995 996 997 998 999 1000 |
|
adelete_nodes
async
#
adelete_nodes(node_ids: Optional[List[str]] = None, filters: Optional[MetadataFilters] = None, **delete_kwargs: Any) -> None
Async deletes nodes async.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_ids
|
Optional[List[str]]
|
IDs of nodes to delete. Defaults to None. |
None
|
filters
|
Optional[MetadataFilters]
|
Metadata filters. Defaults to None. |
None
|
Source code in llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/llama_index/vector_stores/opensearch/base.py
1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 |
|
clear #
clear() -> None
Clears index.
Source code in llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/llama_index/vector_stores/opensearch/base.py
1016 1017 1018 |
|
aclear
async
#
aclear() -> None
Async clears index.
Source code in llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/llama_index/vector_stores/opensearch/base.py
1020 1021 1022 |
|
query #
query(query: VectorStoreQuery, **kwargs: Any) -> VectorStoreQueryResult
Query index for top k most similar nodes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
VectorStoreQuery
|
Store query object. |
required |
Source code in llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/llama_index/vector_stores/opensearch/base.py
1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 |
|
aquery
async
#
aquery(query: VectorStoreQuery, **kwargs: Any) -> VectorStoreQueryResult
Async query index for top k most similar nodes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
VectorStoreQuery
|
Store query object. |
required |
Source code in llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/llama_index/vector_stores/opensearch/base.py
1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 |
|