Skip to content

Indexes in KDB.AI

This section contains details of the available indexes in KDB.AI and key parameters that can be tailored to specific use cases.

FLAT

The Flat search performs an exhaustive search against all vectors in the search space. You can configure it with a number of distance metrics. As the search is exhaustive, it finds the exact nearest neighbors without approximations.

Build Parameters

Option Description Type Required Default
dims Number of dimensions long true 8

IVF

When using a Flat Inverted File search, first you train the index on a set of points that are used to generate cluster centroids using a k-means algorithm. The data is not partitioned into a cluster based on centroid distance. The search is performed by running a flat search against the most relevant clusters. As only a subset of the data is searched, the results are returned much quicker, but as a consequence can be less accurate.

Build Parameters

Option Description Type Required Default
nclusters Number of clusters int false 8

Search Parameters

  • index_options at search() (and dense_index_options at hybrid_search())
Option Description Type Required Default
clusters The number of clusters to be traversed in the search int false 2

Training is required to initialize the IVF index.

IVFPQ

You can compress input data using the product quantization method before applying the IVF schema above. This is known as IVFPQ. This can greatly reduce the size of the index held in memory and improve search speeds.

Build Parameters

Option Description Type Required Default
nclusters Number of clusters int false 8
nsplits Number of splits int false 8
nbits Number of bits int false 8

Search Parameters

  • index_options at search() (and dense_index_options at hybrid_search())
Option Description Type Required Default
clusters The number of clusters to be traversed in the search int false 2

Training is required, to initialize the IVFPQ index.

HNSW

A HNSW index establishes connections between vertices in the graph based on their distances. These links are instrumental in enabling efficient traversal and navigation through the hierarchical graph during the search process.

The HNSW index can be searched to navigate through the layers of the graph to find increasingly similar data in the graph. This approach is extremely efficient with search performance a measure of the complexity of the graph.

Build Parameters

Option Description Type Required Default
dims Number of dimensions long true 8
efConstruction Nodes at each step (construction) int false 8
M Valence of each node in graph int false 8

Search Parameters

  • index_options at search() (and dense_index_options at hybrid_search())
Option Description Type Required Default
efSearch Nodes considered at each step (search) int false 8

For coding example of using the argument index_options at search() (and dense_index_options at hybrid_search()), see the Python API Client page.