🔗Access

This guide explains how to access existing indexes on the enVector server, list all available indexes, and create client SDK objects to examine their contents and perform operations.

Overall Usage

The process of accessing existing indexes involves these main steps:

  1. Connect to Server - Initialize the SDK and connect to the enVector server

  2. List Available Indexes - Retrieve a list of all indexes currently on the server

  3. Get Index Information - Obtain detailed information about specific indexes

  4. Create Index Objects - Instantiate Index objects for existing indexes to perform operations

  5. Examine Index Contents - Access index data, metadata, and perform searches

Detailed Usage Using Arguments

1. Connect to the Server

First, establish a connection to the enVector server:

import pyenvector as ev

# Initialize connection to the server
HOST_ADDRESS = "your.hostname:50050"
ev.init(address=HOST_ADDRESS, key_path="./keys", key_id="your-key-id")

print("Connected to enVector server successfully")

2. List All Available Indexes

Retrieve a list of all indexes currently registered on the server:

3. Get Detailed Index Information

For each index, you can retrieve detailed information:

Alternatively, you can simply print the returned value of the get_index_info API:

4. Create Index Objects for Existing Indexes

Create Index objects to interact with existing indexes:

5. Examine Index Contents

Once you have Index objects, you can examine their contents by simply printing the object:

You can also access the index configuration object to examine specific settings:

6. Complete Working Example

Here's a complete script that demonstrates all the functionality described above:

7. Error Handling

Here's an example of comprehensive error handling:

8. Best Practices

  1. Connection Management: Always check connection status before performing operations

  2. Error Handling: Implement comprehensive error handling for network and configuration issues

  3. Resource Cleanup: Properly manage Index objects to avoid memory leaks

9. Troubleshooting

Common Issues and Solutions:

  • "Indexer not connected": Reinitialize the SDK with ev.init()

  • "Key ID not found": Register the key first using ev.register_key()

  • "Index not found": Verify the index name exists using ev.get_index_list()

  • Connection timeouts: Check network connectivity and server status

This guide provides comprehensive coverage of accessing existing indexes on the enVector server, allowing you to examine their contents and perform operations using the client SDK.

Last updated