Skip to main content
POST
Train Index
Train an index for efficient querying. Required before optimal performance.

Authentication

Required - API key via X-API-Key header:
You can get an API key from the CyborgDB Admin Dashboard. For more info, follow this guide.

Request Body

Response

Training Completed:
Training Already In Progress:
If an index is already being trained (either manually or via automatic training trigger), the API will return an in_progress status instead of starting a new training session.

Exceptions

  • 401: Authentication failed (invalid API key)
  • 404: Index not found
  • 422: Invalid request parameters or insufficient vectors
  • 500: Internal server error

Example Usage

Basic Training:
Custom Training Parameters:
There must be at least 2 * n_lists vector embeddings in the index prior to training.

Training Requirements

  • Minimum vectors: At least 2 × n_lists vectors must be present in the index
  • Memory: Training may require significant memory depending on batch_size and dataset size
  • Time: Training duration varies based on dataset size and convergence parameters

Use Cases

  • Performance optimization: Enable fast approximate nearest neighbor search
  • Production preparation: Train indexes before deploying to production
  • Batch processing: Train indexes after bulk data ingestion
  • Index maintenance: Retrain indexes after significant data updates