Skip to main content
Trains the encrypted index to optimize it for efficient similarity search queries. Training is essential for IVF-based indexes to achieve optimal query performance and accuracy.
In CyborgDB Service v0.17, training is auto-triggered server-side once upserts cross the configured RETRAIN_THRESHOLD. The Go SDK’s Upsert response only carries Status and Message — to observe training, call IsTraining. Calling Train explicitly forces immediate clustering and is useful when you want to block until the index is ready (for example, before benchmarking queries). Auto-training can be disabled service-side with the AUTO_TRAIN_DISABLED setting.

Parameters

TrainParams Fields

Training is a compute-intensive operation that may take several seconds to minutes depending on the index size and configuration.

Returns

  • error: Any error encountered during training, or nil if successful

Error Handling

  • Returns error if the API request fails due to network connectivity issues
  • Returns error if authentication fails (invalid API key)
  • Returns error if the encryption key is invalid for the specified index
  • Returns error if there are internal server errors during training
  • Returns error if the index has insufficient data for training
  • Returns error if training parameters are invalid or out of range
  • Returns error if training fails due to memory constraints

Example Usage

Training with Custom Parameters