Add/update Datapoints into an Index.
HTTP request
POST https://{service-endpoint}/v1/{index}:upsertDatapoints
Where {service-endpoint}
is one of the supported service endpoints.
Path parameters
Parameters | |
---|---|
index |
Required. The name of the Index resource to be updated. Format: |
Request body
The request body contains data with the following structure:
JSON representation |
---|
{
"datapoints": [
{
object ( |
Fields | |
---|---|
datapoints[] |
A list of datapoints to be created/updated. |
updateMask |
Optional. Update mask is used to specify the fields to be overwritten in the datapoints by the update. The fields specified in the updateMask are relative to each IndexDatapoint inside datapoints, not the full request. Updatable fields:
This is a comma-separated list of fully qualified names of fields. Example: |
Response body
If successful, the response body is empty.
Authorization scopes
Requires the following OAuth scope:
https://www.googleapis.com/auth/cloud-platform
For more information, see the Authentication Overview.
IAM Permissions
Requires the following IAM permission on the index
resource:
aiplatform.indexes.update
For more information, see the IAM documentation.
IndexDatapoint
A datapoint of Index.
JSON representation |
---|
{ "datapointId": string, "featureVector": [ number ], "restricts": [ { object ( |
Fields | |
---|---|
datapointId |
Required. Unique identifier of the datapoint. |
featureVector[] |
Required. feature embedding vector for dense index. An array of numbers with the length of [NearestNeighborSearchConfig.dimensions]. |
restricts[] |
Optional. List of Restrict of the datapoint, used to perform "restricted searches" where boolean rule are used to filter the subset of the database eligible for matching. This uses categorical tokens. See: https://cloud.google.com/vertex-ai/docs/matching-engine/filtering |
numericRestricts[] |
Optional. List of Restrict of the datapoint, used to perform "restricted searches" where boolean rule are used to filter the subset of the database eligible for matching. This uses numeric comparisons. |
crowdingTag |
Optional. CrowdingTag of the datapoint, the number of neighbors to return in each crowding can be configured during query. |
Restriction
Restriction of a datapoint which describe its attributes(tokens) from each of several attribute categories(namespaces).
JSON representation |
---|
{ "namespace": string, "allowList": [ string ], "denyList": [ string ] } |
Fields | |
---|---|
namespace |
The namespace of this restriction. e.g.: color. |
allowList[] |
The attributes to allow in this namespace. e.g.: 'red' |
denyList[] |
The attributes to deny in this namespace. e.g.: 'blue' |
NumericRestriction
This field allows restricts to be based on numeric comparisons rather than categorical tokens.
JSON representation |
---|
{ "namespace": string, "op": enum ( |
Fields | |
---|---|
namespace |
The namespace of this restriction. e.g.: cost. |
op |
This MUST be specified for queries and must NOT be specified for datapoints. |
Union field Value . The type of Value must be consistent for all datapoints with a given namespace name. This is verified at runtime. Value can be only one of the following: |
|
valueInt |
Represents 64 bit integer. |
valueFloat |
Represents 32 bit float. |
valueDouble |
Represents 64 bit float. |
Operator
Which comparison operator to use. Should be specified for queries only; specifying this for a datapoint is an error.
Datapoints for which Operator is true relative to the query's value field will be allowlisted.
Enums | |
---|---|
OPERATOR_UNSPECIFIED |
Default value of the enum. |
LESS |
Datapoints are eligible iff their value is < the query's. |
LESS_EQUAL |
Datapoints are eligible iff their value is <= the query's. |
EQUAL |
Datapoints are eligible iff their value is == the query's. |
GREATER_EQUAL |
Datapoints are eligible iff their value is >= the query's. |
GREATER |
Datapoints are eligible iff their value is > the query's. |
NOT_EQUAL |
Datapoints are eligible iff their value is != the query's. |
CrowdingTag
Crowding tag is a constraint on a neighbor list produced by nearest neighbor search requiring that no more than some value k' of the k neighbors returned have the same value of crowdingAttribute.
JSON representation |
---|
{ "crowdingAttribute": string } |
Fields | |
---|---|
crowdingAttribute |
The attribute value used for crowding. The maximum number of neighbors to return per crowding attribute value (perCrowdingAttributeNumNeighbors) is configured per-query. This field is ignored if perCrowdingAttributeNumNeighbors is larger than the total number of neighbors to return for a given query. |