Delete a schema for structured data Stay organized with collections Save and categorize content based on your preferences.
You can only delete a schema if all of the documents associated with the schemaare deleted. Otherwise, the attempt fails. After you delete a schema, you cancall theschemas.create method to create a new one.
To delete a schema for structured data, follow these steps:
REST
Find your data store ID. If you already have your data storeID, skip to the next step.
In the Google Cloud console, go to theAI Applications page andin the navigation menu, clickData Stores.
Click the name of your data store.
On theData page for your data store, get the data store ID.
Delete your schema.
curl-XDELETE\-H"Authorization: Bearer$(gcloudauthprint-access-token)"\-H"Content-Type: application/json"\"https://discoveryengine.googleapis.com/v1beta/projects/PROJECT_ID/locations/global/collections/default_collection/dataStores/DATA_STORE_ID/schemas/default_schema"Replace the following:
PROJECT_ID: the ID of your project.DATA_STORE_ID: the ID of your data store.
C#
For more information, see theVertex AI SearchC# API reference documentation.
To authenticate to Vertex AI Search, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.
usingGoogle.Cloud.DiscoveryEngine.V1;usingGoogle.LongRunning;usingGoogle.Protobuf.WellKnownTypes;publicsealedpartialclassGeneratedSchemaServiceClientSnippets{/// <summary>Snippet for DeleteSchema</summary>/// <remarks>/// This snippet has been automatically generated and should be regarded as a code template only./// It will require modifications to work:/// - It may require correct/in-range values for request initialization./// - It may require specifying regional endpoints when creating the service client as shown in/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint./// </remarks>publicvoidDeleteSchemaRequestObject(){// Create clientSchemaServiceClientschemaServiceClient=SchemaServiceClient.Create();// Initialize request argument(s)DeleteSchemaRequestrequest=newDeleteSchemaRequest{SchemaName=SchemaName.FromProjectLocationDataStoreSchema("[PROJECT]","[LOCATION]","[DATA_STORE]","[SCHEMA]"),};// Make the requestOperation<Empty,DeleteSchemaMetadata>response=schemaServiceClient.DeleteSchema(request);// Poll until the returned long-running operation is completeOperation<Empty,DeleteSchemaMetadata>completedResponse=response.PollUntilCompleted();// Retrieve the operation resultEmptyresult=completedResponse.Result;// Or get the name of the operationstringoperationName=response.Name;// This name can be stored, then the long-running operation retrieved later by nameOperation<Empty,DeleteSchemaMetadata>retrievedResponse=schemaServiceClient.PollOnceDeleteSchema(operationName);// Check if the retrieved long-running operation has completedif(retrievedResponse.IsCompleted){// If it has completed, then access the resultEmptyretrievedResult=retrievedResponse.Result;}}}Go
For more information, see theVertex AI SearchGo API reference documentation.
To authenticate to Vertex AI Search, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.
packagemainimport("context"discoveryengine"cloud.google.com/go/discoveryengine/apiv1"discoveryenginepb"cloud.google.com/go/discoveryengine/apiv1/discoveryenginepb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=discoveryengine.NewSchemaClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&discoveryenginepb.DeleteSchemaRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1/discoveryenginepb#DeleteSchemaRequest.}op,err:=c.DeleteSchema(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}Java
For more information, see theVertex AI SearchJava API reference documentation.
To authenticate to Vertex AI Search, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.
importcom.google.cloud.discoveryengine.v1.DeleteSchemaRequest;importcom.google.cloud.discoveryengine.v1.SchemaName;importcom.google.cloud.discoveryengine.v1.SchemaServiceClient;importcom.google.protobuf.Empty;publicclassSyncDeleteSchema{publicstaticvoidmain(String[]args)throwsException{syncDeleteSchema();}publicstaticvoidsyncDeleteSchema()throwsException{// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_librarytry(SchemaServiceClientschemaServiceClient=SchemaServiceClient.create()){DeleteSchemaRequestrequest=DeleteSchemaRequest.newBuilder().setName(SchemaName.ofProjectLocationDataStoreSchemaName("[PROJECT]","[LOCATION]","[DATA_STORE]","[SCHEMA]").toString()).build();schemaServiceClient.deleteSchemaAsync(request).get();}}}Python
For more information, see theVertex AI SearchPython API reference documentation.
To authenticate to Vertex AI Search, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.
# This snippet has been automatically generated and should be regarded as a# code template only.# It will require modifications to work:# - It may require correct/in-range values for request initialization.# - It may require specifying regional endpoints when creating the service# client as shown in:# https://googleapis.dev/python/google-api-core/latest/client_options.htmlfromgoogle.cloudimportdiscoveryengine_v1defsample_delete_schema():# Create a clientclient=discoveryengine_v1.SchemaServiceClient()# Initialize request argument(s)request=discoveryengine_v1.DeleteSchemaRequest(name="name_value",)# Make the requestoperation=client.delete_schema(request=request)print("Waiting for operation to complete...")response=operation.result()# Handle the responseprint(response)Ruby
For more information, see theVertex AI SearchRuby API reference documentation.
To authenticate to Vertex AI Search, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.
require"google/cloud/discovery_engine/v1"### Snippet for the delete_schema call in the SchemaService service## This snippet has been automatically generated and should be regarded as a code# template only. It will require modifications to work:# - It may require correct/in-range values for request initialization.# - It may require specifying regional endpoints when creating the service# client as shown in https://cloud.google.com/ruby/docs/reference.## This is an auto-generated example demonstrating basic usage of# Google::Cloud::DiscoveryEngine::V1::SchemaService::Client#delete_schema.#defdelete_schema# Create a client object. The client can be reused for multiple calls.client=Google::Cloud::DiscoveryEngine::V1::SchemaService::Client.new# Create a request. To set request fields, pass in keyword arguments.request=Google::Cloud::DiscoveryEngine::V1::DeleteSchemaRequest.new# Call the delete_schema method.result=client.delete_schemarequest# The returned object is of type Gapic::Operation. You can use it to# check the status of an operation, cancel it, or wait for results.# Here is how to wait for a response.result.wait_until_done!timeout:60ifresult.response?presult.responseelseputs"No response received."endendExcept 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-02-18 UTC.