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
828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 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 |
|
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
882 883 884 885 886 887 888 889 890 891 892 893 894 895 |
|
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
897 898 899 900 901 902 903 904 905 906 907 908 909 910 |
|
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
912 913 914 915 916 917 918 919 920 |
|
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
922 923 924 925 926 927 928 929 930 |
|
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
932 933 934 935 936 937 938 939 940 941 942 943 944 |
|
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
946 947 948 949 950 951 952 953 954 955 956 957 958 |
|
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
960 961 962 |
|
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
964 965 966 |
|
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
968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 |
|
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
986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 |
|