Index configuration parameters

To configure indexes for similarity searches, you need to configure thefollowing fields.

For instructions on how to configure an index, seeConfigure index parameters.

NearestNeighborSearch

Fields
contentsDeltaUri

string

Allows inserting, updating or deleting the contents of the Vector SearchIndex. The string must be a valid Cloud Storage directory path, such asgs://BUCKET_NAME/PATH_TO_INDEX_DIR/.

If you set this field when callingIndexService.UpdateIndex, then no otherIndex field can be also updated as part of the same call. Learn how to structure individual data files.

isCompleteOverwrite

boolean

If this field is set together withcontentsDeltaUri when callingIndexService.UpdateIndex, then existing content of theIndex will be replaced by the data from thecontentsDeltaUri. When this field is set to true, the entire index is completely overwritten with the new metadata file that you provide.

config

NearestNeighborSearchConfig

The configuration of the Vector SearchIndex.

NearestNeighborSearchConfig

Fields
dimensions

int32

Required. The number of dimensions of the input vectors. Used for dense embeddings only.

approximateNeighborsCount

int32

Required if tree-AH algorithm is used.

The default number of neighbors to find through approximate search before exact reordering is performed. Exact reordering is a procedure where results returned by an approximate search algorithm are reordered using a more expensive distance computation.

ShardSizeShardSize

The size of each shard. When an index is large, it is sharded based on the specified shard size. During serving, each shard is served on a separate node and scales independently.

distanceMeasureType

DistanceMeasureType

The distance measure used in nearest neighbor search.

featureNormType

FeatureNormType

Type of normalization to be carried out on each vector.

algorithmConfigoneOf:

The configuration for the algorithms that Vector Search uses for efficient search. Used for dense embeddings only.

  • TreeAhConfig: Configuration options for using the tree-AH algorithm. For more information, see this blogScaling deep retrieval with TensorFlow Recommenders and Vector Search
  • BruteForceConfig: This option implements the standard linear search in the database for each query. There are no fields to configure for a brute force search. To select this algorithm, pass an empty object forBruteForceConfig.

DistanceMeasureType

Enums
SQUARED_L2_DISTANCEEuclidean (L2) Distance
L1_DISTANCEManhattan (L1) Distance
DOT_PRODUCT_DISTANCEDefault value. Defined as a negative of the dot product.
COSINE_DISTANCECosine Distance. We strongly suggest using DOT_PRODUCT_DISTANCE + UNIT_L2_NORM instead of the COSINE distance. Our algorithms have been more optimized for the DOT_PRODUCT distance, and when combined with UNIT_L2_NORM, it offers the same ranking and mathematical equivalence as the COSINE distance.

ShardSize

Enums
SHARD_SIZE_SMALL2 GiB per shard
SHARD_SIZE_MEDIUM20 GiB per shard
SHARD_SIZE_LARGE50 GiB per shard

FeatureNormType

Enums
UNIT_L2_NORMUnit L2 normalization type.
NONE Default value. No normalization type is specified.

TreeAhConfig

These are the fields to select for the tree-AH algorithm.

Fields
fractionLeafNodesToSearchdouble
The default fraction of leaf nodes that any query may be searched. Must be in range 0.0 - 1.0, exclusive. The default value is 0.05 if not set.
leafNodeEmbeddingCountint32
Number of embeddings on each leaf node. The default value is 1000 if not set.
leafNodesToSearchPercentint32
Deprecated, usefractionLeafNodesToSearch.

The default percentage of leaf nodes that any query may be searched. Must be in range 1-100, inclusive. The default value is 10 (means 10%) if not set.

BruteForceConfig

This option implements the standard linear search in the database foreach query. There are no fields to configure for a brute force search.To select this algorithm, pass an empty object forBruteForceConfigtoalgorithmConfig.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-15 UTC.