VectorSearch

Defines a search operation using a query vector.

JSON representation
{"searchField":string,"filter":{object},"outputFields":{object (OutputFields)},"searchHint":{object (SearchHint)},"distanceMetric":enum (DistanceMetric),// Union fieldvector_type can be only one of the following:"vector":{object (DenseVector)},"sparseVector":{object (SparseVector)}// End of list of possible types for union fieldvector_type."topK":integer}
Fields
searchField

string

Required. The vector field to search.

filter

object (Struct format)

Optional. A JSON filter expression, e.g. {"genre": {"$eq": "sci-fi"}}, represented as a google.protobuf.Struct.

outputFields

object (OutputFields)

Optional. Mask specifying which fields to return.

searchHint

object (SearchHint)

Optional. Sets the search hint. If no strategy is specified, the service will use an index if one is available, and fall back to the default KNN search otherwise.

distanceMetric

enum (DistanceMetric)

Optional. The distance metric to use for the KNN search. If not specified, DOT_PRODUCT will be used as the default.

Union fieldvector_type.

vector_type can be only one of the following:

vector

object (DenseVector)

A dense vector for the query.

sparseVector

object (SparseVector)

A sparse vector for the query.

topK

integer

Optional. The number of nearest neighbors to return.

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 2026-01-29 UTC.