# VectorSearch

Defines a search operation using a query vector.

| JSON representation |
|---|
| ``` { "searchField": string, "filter": { object }, "outputFields": { object (`https://docs.cloud.google.com/gemini-enterprise-agent-platform/build/vector-search-2/reference/rest/v1/OutputFields`) }, "searchHint": { object (`https://docs.cloud.google.com/gemini-enterprise-agent-platform/build/vector-search-2/reference/rest/v1/SearchHint`) }, "distanceMetric": enum (`https://docs.cloud.google.com/gemini-enterprise-agent-platform/build/vector-search-2/reference/rest/v1/projects.locations.collections.indexes#DistanceMetric`), // Union field `vector_type` can be only one of the following: "vector": { object (`https://docs.cloud.google.com/gemini-enterprise-agent-platform/build/vector-search-2/reference/rest/v1/projects.locations.collections.dataObjects#DenseVector`) }, "sparseVector": { object (`https://docs.cloud.google.com/gemini-enterprise-agent-platform/build/vector-search-2/reference/rest/v1/projects.locations.collections.dataObjects#SparseVector`) } // End of list of possible types for union field `vector_type`. "topK": integer } ``` |

| Fields ||
|---|---|
| `searchField` | `string` Required. The vector field to search. |
| `filter` | ``object (`https://protobuf.dev/reference/protobuf/google.protobuf#struct` format)`` Optional. A JSON filter expression, e.g. {"genre": {"$eq": "sci-fi"}}, represented as a google.protobuf.Struct. |
| `outputFields` | ``object (`https://docs.cloud.google.com/gemini-enterprise-agent-platform/build/vector-search-2/reference/rest/v1/OutputFields`)`` Optional. Mask specifying which fields to return. |
| `searchHint` | ``object (`https://docs.cloud.google.com/gemini-enterprise-agent-platform/build/vector-search-2/reference/rest/v1/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 (`https://docs.cloud.google.com/gemini-enterprise-agent-platform/build/vector-search-2/reference/rest/v1/projects.locations.collections.indexes#DistanceMetric`)`` Optional. The distance metric to use for the KNN search. If not specified, DOT_PRODUCT will be used as the default. |
| Union field `vector_type`. Specifies the type of vector to use for the query. `vector_type` can be only one of the following: ||
| `vector` | ``object (`https://docs.cloud.google.com/gemini-enterprise-agent-platform/build/vector-search-2/reference/rest/v1/projects.locations.collections.dataObjects#DenseVector`)`` A dense vector for the query. |
| `sparseVector` | ``object (`https://docs.cloud.google.com/gemini-enterprise-agent-platform/build/vector-search-2/reference/rest/v1/projects.locations.collections.dataObjects#SparseVector`)`` A sparse vector for the query. |
| `topK` | `integer` Optional. The number of nearest neighbors to return. |