Stay organized with collectionsSave and categorize content based on your preferences.
If your online store uses Bigtable online serving, you can directly update
feature values in a feature view without updating the feature data source
in real-time. You can either update the feature values for an existing ID, or
add a new entity ID along with the corresponding feature values. Use this
capability in the following scenarios:
You want to write features to an online store faster than batch sync, while
maintaining data freshness at 100ms or less.
You want to retrieve the timestamp when the
feature is written to the online store.
Vertex AI Feature Store doesn't update the feature data source in BigQuery
based on the feature data that written directly to a feature view instance.
During data sync, Vertex AI Feature Store updates the feature view
with the feature value having the most recent timestamp. For example, if you update
a feature value directly in a feature view, and subsequently update the same
feature in the BigQuery source, then
Vertex AI Feature Store updates the feature view with the most
recently updated feature value from BigQuery during the next
data sync.
If you want to add or update feature values for a feature column that's used in
multiple feature views, then you must make the same updates to each feature view
separately.
If an online store instance is configured for Optimized online serving,
you can't write features directly to a feature view within that online store.
Note that this capability doesn't let you add or remove feature columns in a
feature view. Also, you can't delete existing feature values or entity IDs.
Before you begin
Authenticate
to
Vertex AI, unless you've done so already.
To use the REST API samples on this page in a local development environment, you use the
credentials you provide to the gcloud CLI.
Installthe Google Cloud CLI.
After installation,initializethe Google Cloud CLI by running the following command:
Before using any of the request data,
make the following replacements:
LOCATION_ID: Region for the feature view where you want to write the features, such asus-central1.
PROJECT_ID: Your project ID.
FEATUREONLINESTORE_NAME: The name of the online store instance containing the feature view.
FEATUREVIEW_NAME: The name of the new feature view instance where you want to write the features.
ENTITY_ID: The entity ID for which you want to add feature values.
FEATURE_1andFEATURE_2: The features you want to add.
FEATURE_1_VALUEandFEATURE_2_VALUE: The feature values forFEATURE_1andFEATURE_2, respectively.
HTTP method and URL:
POST https://LOCATION_ID-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION_ID/featureOnlineStores/FEATUREONLINESTORE_NAME/featureViews/FEATUREVIEW_NAME:directWrite
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Update features in a feature view\n\n| **Preview**\n|\n|\n| This feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nIf your online store uses Bigtable online serving, you can directly update\nfeature values in a feature view without updating the feature data source\nin real-time. You can either update the feature values for an existing ID, or\nadd a new entity ID along with the corresponding feature values. Use this\ncapability in the following scenarios:\n\n- You want to write features to an online store faster than batch sync, while\n maintaining data freshness at 100ms or less.\n\n- You want to retrieve the timestamp when the\n feature is written to the online store.\n\nVertex AI Feature Store doesn't update the feature data source in BigQuery\nbased on the feature data that written directly to a feature view instance.\nDuring data sync, Vertex AI Feature Store updates the feature view\nwith the feature value having the most recent timestamp. For example, if you update\na feature value directly in a feature view, and subsequently update the same\nfeature in the BigQuery source, then\nVertex AI Feature Store updates the feature view with the most\nrecently updated feature value from BigQuery during the next\ndata sync.\n\nIf you want to add or update feature values for a feature column that's used in\nmultiple feature views, then you must make the same updates to each feature view\nseparately.\n\nIf an online store instance is configured for Optimized online serving,\nyou can't write features directly to a feature view within that online store.\n\nNote that this capability doesn't let you add or remove feature columns in a\nfeature view. Also, you can't delete existing feature values or entity IDs.\n\nBefore you begin\n----------------\n\n\nto\nVertex AI, unless you've done so already.\n\n\nTo use the REST API samples on this page in a local development environment, you use the\ncredentials you provide to the gcloud CLI.\n\n1. [Install](/sdk/docs/install) the Google Cloud CLI. After installation, [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command: \n\n```bash\ngcloud init\n```\n2. If you're using an external identity provider (IdP), you must first [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n\nFor more information, see\n[Authenticate for using REST](/docs/authentication/rest)\nin the Google Cloud authentication documentation.\n\nUpdate features directly in a feature view\n------------------------------------------\n\nUse the following sample to write features to an entity within a feature view. \n\n### REST\n\n\nTo write features values directly to a\n[`FeatureView`](/vertex-ai/docs/reference/rest/v1/projects.locations.featureOnlineStores.featureViews#resource:-featureView)\ninstance, send a `POST` request by using the\n[`featureViews.directWrite`](/vertex-ai/docs/reference/rest/v1/projects.locations.featureOnlineStores.featureViews/directWrite)\nmethod.\n\n\nBefore using any of the request data,\nmake the following replacements:\n\n- \u003cvar translate=\"no\"\u003eLOCATION_ID\u003c/var\u003e: Region for the feature view where you want to write the features, such as `us-central1`.\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your project ID.\n- \u003cvar translate=\"no\"\u003eFEATUREONLINESTORE_NAME\u003c/var\u003e: The name of the online store instance containing the feature view.\n- \u003cvar translate=\"no\"\u003eFEATUREVIEW_NAME\u003c/var\u003e: The name of the new feature view instance where you want to write the features.\n- \u003cvar translate=\"no\"\u003eENTITY_ID\u003c/var\u003e: The entity ID for which you want to add feature values.\n- \u003cvar translate=\"no\"\u003eFEATURE_1\u003c/var\u003e and \u003cvar translate=\"no\"\u003eFEATURE_2\u003c/var\u003e: The features you want to add.\n- \u003cvar translate=\"no\"\u003eFEATURE_1_VALUE\u003c/var\u003e and \u003cvar translate=\"no\"\u003eFEATURE_2_VALUE\u003c/var\u003e: The feature values for \u003cvar translate=\"no\"\u003eFEATURE_1\u003c/var\u003e and \u003cvar translate=\"no\"\u003eFEATURE_2\u003c/var\u003e, respectively.\n\n\nHTTP method and URL:\n\n```\nPOST https://LOCATION_ID-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION_ID/featureOnlineStores/FEATUREONLINESTORE_NAME/featureViews/FEATUREVIEW_NAME:directWrite\n```\n\n\nRequest JSON body:\n\n```\n[\n {\n \"feature_view\": \"LOCATION_ID-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION_ID/featureOnlineStores/FEATUREONLINESTORE_NAME/featureViews/FEATUREVIEW_NAME\",\n \"data_key_and_feature_values\": {\n \"data_key\": {\n \"key\": \"ENTITY_ID\"\n },\n \"features\": [{\n \"name\": \"FEATURE_1\",\n \"value_and_timestamp\": {\n \"value\": {\n \"string_value\": \"FEATURE_1_VALUE\"\n }\n }\n },\n {\n \"name\": \"FEATURE_2\",\n \"value_and_timestamp\": {\n \"value\": {\n \"string_value\": \"FEATURE_2_VALUE\"\n }\n }\n }\n ]\n }\n }\n]\n\n```\n\nTo send your request, choose one of these options: \n\n#### curl\n\n| **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login) , or by using [Cloud Shell](/shell/docs), which automatically logs you into the `gcloud` CLI . You can check the currently active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n\nSave the request body in a file named `request.json`,\nand execute the following command:\n\n```\ncurl -X POST \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json; charset=utf-8\" \\\n -d @request.json \\\n \"https://LOCATION_ID-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION_ID/featureOnlineStores/FEATUREONLINESTORE_NAME/featureViews/FEATUREVIEW_NAME:directWrite\"\n```\n\n#### PowerShell\n\n| **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login) . You can check the currently active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n\nSave the request body in a file named `request.json`,\nand execute the following command:\n\n```\n$cred = gcloud auth print-access-token\n$headers = @{ \"Authorization\" = \"Bearer $cred\" }\n\nInvoke-WebRequest `\n -Method POST `\n -Headers $headers `\n -ContentType: \"application/json; charset=utf-8\" `\n -InFile request.json `\n -Uri \"https://LOCATION_ID-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION_ID/featureOnlineStores/FEATUREONLINESTORE_NAME/featureViews/FEATUREVIEW_NAME:directWrite\" | Select-Object -Expand Content\n```\n\nYou should receive a JSON response similar to the following:\n\n```\n{\n \"status\": {},\n \"writeResponses\": [\n {\n \"dataKey\": {\n \"key\": \"ENTITY_ID\"\n },\n \"onlineStoreWriteTime\": \"2025-04-01T01:30:09.525061Z\"\n }\n ]\n}\n```\n\n\u003cbr /\u003e\n\nWhat's next\n-----------\n\n- Learn how to [manually start a data sync](/vertex-ai/docs/featurestore/latest/sync-data).\n\n- Learn how to [update a feature view](/vertex-ai/docs/featurestore/latest/update-featureview)."]]