---
title: "POST /v1/{+featureView}:searchNearestEntities"
method: POST
path: "/v1/{+featureView}:searchNearestEntities"
tags: ["projects"]
---

# POST /v1/{+featureView}:searchNearestEntities

`POST /v1/{+featureView}:searchNearestEntities`

Search the nearest entities under a FeatureView. Search only works for indexable feature view; if a feature view isn't indexable, returns Invalid argument response.

## Path parameters

- `featureView` string, required

## Request body

- GoogleCloudAiplatformV1SearchNearestEntitiesRequest — The request message for FeatureOnlineStoreService.SearchNearestEntities.
  - `query` GoogleCloudAiplatformV1NearestNeighborQuery — A query to find a number of similar entities.
    - `embedding` GoogleCloudAiplatformV1NearestNeighborQueryEmbedding — The embedding vector.
      - `value` number[] — Optional. Individual value in the embedding.
    - `numericFilters` GoogleCloudAiplatformV1NearestNeighborQueryNumericFilter[] — Optional. The list of numeric filters.
      - `valueInt` string, int64 — int value type.
      - `valueDouble` number, double — double value type.
      - `name` string — Required. Column name in BigQuery that used as filters.
      - `valueFloat` number, float — float value type.
      - `op` 'OPERATOR_UNSPECIFIED' | 'LESS' | 'LESS_EQUAL' | 'EQUAL' | 'GREATER_EQUAL' | 'GREATER' | 'NOT_EQUAL' — Optional. This MUST be specified for queries and must NOT be specified for database points.
    - `stringFilters` GoogleCloudAiplatformV1NearestNeighborQueryStringFilter[] — Optional. The list of string filters.
      - `allowTokens` string[] — Optional. The allowed tokens.
      - `name` string — Required. Column names in BigQuery that used as filters.
      - `denyTokens` string[] — Optional. The denied tokens.
    - `entityId` string — Optional. The entity id whose similar entities should be searched for. If embedding is set, search will use embedding instead of entity_id.
    - `neighborCount` integer — Optional. The number of similar entities to be retrieved from feature view for each query.
    - `perCrowdingAttributeNeighborCount` integer — Optional. Crowding is a constraint on a neighbor list produced by nearest neighbor search requiring that no more than sper_crowding_attribute_neighbor_count of the k neighbors returned have the same value of crowding_attribute. It's used for improving result diversity.
    - `parameters` GoogleCloudAiplatformV1NearestNeighborQueryParameters — Parameters that can be overrided in each query to tune query latency and recall.
      - `leafNodesSearchFraction` number, double — Optional. The fraction of the number of leaves to search, set at query time allows user to tune search performance. This value increase result in both search accuracy and latency increase. The value should be between 0.0 and 1.0.
      - `approximateNeighborCandidates` integer — Optional. The number of neighbors to find via approximate search before exact reordering is performed; if set, this value must be > neighbor_count.
  - `returnFullEntity` boolean — Optional. If set to true, the full entities (including all vector values and metadata) of the nearest neighbors are returned; otherwise only entity id of the nearest neighbors will be returned. Note that returning full entities will significantly increase the latency and cost of the query.

## Response `200`

Successful response

---

[API](https://skmtc.net/google/apis/aiplatform.md) · [All operations](https://skmtc.net/google/apis/aiplatform/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/google/aiplatform/versions/b608d71b91f0/schema)
