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
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 |
|
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
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 |
|
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
509 510 511 512 513 514 515 516 517 518 519 520 521 522 |
|
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
524 525 526 527 528 529 530 531 532 533 534 |
|
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
536 537 538 539 540 541 542 543 544 |
|
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
546 547 548 549 550 551 552 553 554 |
|
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
556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 |
|