interface IndexConfig {
    createAllMetricIndexes?: boolean;
    dims: number;
    distanceMetric?: DistanceMetric;
    embed: Embeddings | EmbeddingsFunc;
    fields?: string[];
    hnsw?: HNSWConfig;
    indexType?: VectorIndexType;
    ivfflat?: IVFFlatConfig;
}

Properties

createAllMetricIndexes?: boolean

Whether to create indexes for all distance metrics. If false, only creates index for the specified distanceMetric.

Default

false
dims: number

Number of dimensions in the embedding vectors.

distanceMetric?: DistanceMetric

Distance metric for vector similarity.

Default

'cosine'

Embedding function to generate embeddings from text. Can be a LangChain Embeddings instance or a function.

fields?: string[]

Fields to extract text from for embedding generation. Uses JSON path syntax. Defaults to ["$"] (entire document).

hnsw?: HNSWConfig

HNSW-specific configuration parameters. Only used when indexType is 'hnsw'.

indexType?: VectorIndexType

Vector index type to use.

  • 'hnsw': Hierarchical Navigable Small World (best for most use cases)
  • 'ivfflat': Inverted File with Flat compression (good for large datasets)

Default

'hnsw'
ivfflat?: IVFFlatConfig

IVFFlat-specific configuration parameters. Only used when indexType is 'ivfflat'.