Skip to main content
Retrieve specific points from your collection by their IDs. Choose to include vector data, payload metadata, or both.

Retrieve points by ID

The retrieve() method is an alias for get_many(). Control what data is returned with these options:
  • with_vectors=False — Reduces bandwidth when you only need payload metadata.
  • with_payload=False — Returns only vectors, useful for computation without metadata.
from actian_vectorai import VectorAIClient

COLLECTION = "products"

# Connect to VectorAI DB server
with VectorAIClient("localhost:50051") as client:
    # Retrieve specific points by ID
    retrieve_ids = [1, 2, 3, 5]
    results = client.points.get(COLLECTION, ids=retrieve_ids)
    
    # Display results
    for point in results:
        print(f"ID {point.id}:")
        if point.vectors:
            print(f"  Vector dimensions: {len(point.vectors)}")
        if point.payload:
            print(f"  Payload: {point.payload}")
By default, both vectors and payloads are included in the response. Each point includes these fields:
  • id: The unique identifier of the point.
  • vector: The vector embedding (array of floats) if requested.
  • payload: The metadata dictionary if requested.

Scroll through points

Scroll operations are ideal for processing large collections that do not fit in memory. The cursor tracks your position in the collection, allowing you to process data in manageable chunks.
from actian_vectorai import VectorAIClient

COLLECTION = "products"

# Connect to VectorAI DB server
with VectorAIClient("localhost:50051") as client:
    all_points = []
    offset = None  # Start from beginning
    page_num = 1
    
    while True:
        # Get next page of results
        results, next_offset = client.points.scroll(
            COLLECTION,  # Collection name
            limit=3,  # Points per page
            offset=offset,  # Current position
            with_vectors=False,  # Exclude vectors
            with_payload=True  # Include payloads
        )
        
        # Break if no results
        if not results:
            break
        
        # Display page results
        print(f"\nPage {page_num} ({len(results)} points):")
        for point in results:
            print(f"  ID {point.id}: {point.payload}")
            all_points.append(point)
        
        # Check for more pages
        if next_offset is None:
            break
        
        # Move to next page
        offset = next_offset
        page_num += 1
    
    print(f"\nTotal points retrieved: {len(all_points)}")
The method returns this data:
  • results: List of points for the current page.
    • id: The unique identifier of the point.
    • vector: The vector embedding if requested.
    • payload: The metadata dictionary if requested.
  • next_offset: Cursor position for the next page (None if no more pages).