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
578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 |
|
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
632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 |
|
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
648 649 650 651 652 653 654 655 656 657 658 659 660 661 |
|
delete #
delete(ref_doc_id: str, **delete_kwargs: Any) -> None
Delete nodes using a ref_doc_id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ref_doc_id |
str
|
The doc_id of the document whose nodes should be deleted. |
required |
Source code in llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/llama_index/vector_stores/opensearch/base.py
663 664 665 666 667 668 669 670 671 672 673 |
|
adelete
async
#
adelete(ref_doc_id: str, **delete_kwargs: Any) -> None
Async delete nodes using a ref_doc_id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ref_doc_id |
str
|
The doc_id of the document whose nodes should be deleted. |
required |
Source code in llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/llama_index/vector_stores/opensearch/base.py
675 676 677 678 679 680 681 682 683 |
|
adelete_nodes
async
#
adelete_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
685 686 687 688 689 690 691 692 693 694 695 696 697 |
|
delete_nodes #
delete_nodes(node_ids: Optional[List[str]] = None, filters: Optional[MetadataFilters] = None, **delete_kwargs: Any) -> None
Deletes nodes.
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
699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 |
|
aclear
async
#
aclear() -> None
Clears index.
Source code in llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/llama_index/vector_stores/opensearch/base.py
715 716 717 |
|
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
719 720 721 |
|
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
723 724 725 726 727 728 729 730 731 |
|
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
733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 |
|