Class IndexServiceClient (3.35.0)

GitHub RepositoryProduct ReferenceREST DocumentationRPC Documentation

Service Description: A service for creating and managing Vertex AI's Index resources.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   IndexName name = IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]");
   Index response = indexServiceClient.getIndex(name);
 }
 

Note: close() needs to be called on the IndexServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

Methods
MethodDescriptionMethod Variants

CreateIndex

Creates an Index.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createIndexAsync(CreateIndexRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • createIndexAsync(LocationName parent, Index index)

  • createIndexAsync(String parent, Index index)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createIndexOperationCallable()

  • createIndexCallable()

GetIndex

Gets an Index.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getIndex(GetIndexRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getIndex(IndexName name)

  • getIndex(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getIndexCallable()

ListIndexes

Lists Indexes in a Location.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listIndexes(ListIndexesRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listIndexes(LocationName parent)

  • listIndexes(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listIndexesPagedCallable()

  • listIndexesCallable()

UpdateIndex

Updates an Index.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateIndexAsync(UpdateIndexRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • updateIndexAsync(Index index, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateIndexOperationCallable()

  • updateIndexCallable()

DeleteIndex

Deletes an Index. An Index can only be deleted when all its DeployedIndexes had been undeployed.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteIndexAsync(DeleteIndexRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • deleteIndexAsync(IndexName name)

  • deleteIndexAsync(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteIndexOperationCallable()

  • deleteIndexCallable()

UpsertDatapoints

Add/update Datapoints into an Index.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • upsertDatapoints(UpsertDatapointsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • upsertDatapointsCallable()

RemoveDatapoints

Remove Datapoints from an Index.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • removeDatapoints(RemoveDatapointsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • removeDatapointsCallable()

ListLocations

Lists information about the supported locations for this service.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listLocations(ListLocationsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listLocationsPagedCallable()

  • listLocationsCallable()

GetLocation

Gets information about a location.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getLocation(GetLocationRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getLocationCallable()

SetIamPolicy

Sets the access control policy on the specified resource. Replacesany existing policy.

Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIEDerrors.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • setIamPolicy(SetIamPolicyRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • setIamPolicyCallable()

GetIamPolicy

Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getIamPolicy(GetIamPolicyRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getIamPolicyCallable()

TestIamPermissions

Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a NOT_FOUND error.

Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • testIamPermissions(TestIamPermissionsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • testIamPermissionsCallable()

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of IndexServiceSettings to create(). For example:

To customize credentials:


 // 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_library
 IndexServiceSettings indexServiceSettings =
     IndexServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 IndexServiceClient indexServiceClient = IndexServiceClient.create(indexServiceSettings);
 

To customize the endpoint:


 // 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_library
 IndexServiceSettings indexServiceSettings =
     IndexServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 IndexServiceClient indexServiceClient = IndexServiceClient.create(indexServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > IndexServiceClient

Static Methods

create()

public static final IndexServiceClient create()

Constructs an instance of IndexServiceClient with default settings.

Returns
TypeDescription
IndexServiceClient
Exceptions
TypeDescription
IOException

create(IndexServiceSettings settings)

public static final IndexServiceClient create(IndexServiceSettings settings)

Constructs an instance of IndexServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
NameDescription
settingsIndexServiceSettings
Returns
TypeDescription
IndexServiceClient
Exceptions
TypeDescription
IOException

create(IndexServiceStub stub)

public static final IndexServiceClient create(IndexServiceStub stub)

Constructs an instance of IndexServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(IndexServiceSettings).

Parameter
NameDescription
stubIndexServiceStub
Returns
TypeDescription
IndexServiceClient

Constructors

IndexServiceClient(IndexServiceSettings settings)

protected IndexServiceClient(IndexServiceSettings settings)

Constructs an instance of IndexServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
NameDescription
settingsIndexServiceSettings

IndexServiceClient(IndexServiceStub stub)

protected IndexServiceClient(IndexServiceStub stub)
Parameter
NameDescription
stubIndexServiceStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

close()

public final void close()

createIndexAsync(CreateIndexRequest request)

public final OperationFuture<Index,CreateIndexOperationMetadata> createIndexAsync(CreateIndexRequest request)

Creates an Index.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   CreateIndexRequest request =
       CreateIndexRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setIndex(Index.newBuilder().build())
           .build();
   Index response = indexServiceClient.createIndexAsync(request).get();
 }
 
Parameter
NameDescription
requestCreateIndexRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Index,CreateIndexOperationMetadata>

createIndexAsync(LocationName parent, Index index)

public final OperationFuture<Index,CreateIndexOperationMetadata> createIndexAsync(LocationName parent, Index index)

Creates an Index.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   Index index = Index.newBuilder().build();
   Index response = indexServiceClient.createIndexAsync(parent, index).get();
 }
 
Parameters
NameDescription
parentLocationName

Required. The resource name of the Location to create the Index in. Format: projects/{project}/locations/{location}

indexIndex

Required. The Index to create.

Returns
TypeDescription
OperationFuture<Index,CreateIndexOperationMetadata>

createIndexAsync(String parent, Index index)

public final OperationFuture<Index,CreateIndexOperationMetadata> createIndexAsync(String parent, Index index)

Creates an Index.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   Index index = Index.newBuilder().build();
   Index response = indexServiceClient.createIndexAsync(parent, index).get();
 }
 
Parameters
NameDescription
parentString

Required. The resource name of the Location to create the Index in. Format: projects/{project}/locations/{location}

indexIndex

Required. The Index to create.

Returns
TypeDescription
OperationFuture<Index,CreateIndexOperationMetadata>

createIndexCallable()

public final UnaryCallable<CreateIndexRequest,Operation> createIndexCallable()

Creates an Index.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   CreateIndexRequest request =
       CreateIndexRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setIndex(Index.newBuilder().build())
           .build();
   ApiFuture<Operation> future = indexServiceClient.createIndexCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateIndexRequest,Operation>

createIndexOperationCallable()

public final OperationCallable<CreateIndexRequest,Index,CreateIndexOperationMetadata> createIndexOperationCallable()

Creates an Index.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   CreateIndexRequest request =
       CreateIndexRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setIndex(Index.newBuilder().build())
           .build();
   OperationFuture<Index, CreateIndexOperationMetadata> future =
       indexServiceClient.createIndexOperationCallable().futureCall(request);
   // Do something.
   Index response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<CreateIndexRequest,Index,CreateIndexOperationMetadata>

deleteIndexAsync(DeleteIndexRequest request)

public final OperationFuture<Empty,DeleteOperationMetadata> deleteIndexAsync(DeleteIndexRequest request)

Deletes an Index. An Index can only be deleted when all its DeployedIndexes had been undeployed.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   DeleteIndexRequest request =
       DeleteIndexRequest.newBuilder()
           .setName(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString())
           .build();
   indexServiceClient.deleteIndexAsync(request).get();
 }
 
Parameter
NameDescription
requestDeleteIndexRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Empty,DeleteOperationMetadata>

deleteIndexAsync(IndexName name)

public final OperationFuture<Empty,DeleteOperationMetadata> deleteIndexAsync(IndexName name)

Deletes an Index. An Index can only be deleted when all its DeployedIndexes had been undeployed.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   IndexName name = IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]");
   indexServiceClient.deleteIndexAsync(name).get();
 }
 
Parameter
NameDescription
nameIndexName

Required. The name of the Index resource to be deleted. Format: projects/{project}/locations/{location}/indexes/{index}

Returns
TypeDescription
OperationFuture<Empty,DeleteOperationMetadata>

deleteIndexAsync(String name)

public final OperationFuture<Empty,DeleteOperationMetadata> deleteIndexAsync(String name)

Deletes an Index. An Index can only be deleted when all its DeployedIndexes had been undeployed.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   String name = IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString();
   indexServiceClient.deleteIndexAsync(name).get();
 }
 
Parameter
NameDescription
nameString

Required. The name of the Index resource to be deleted. Format: projects/{project}/locations/{location}/indexes/{index}

Returns
TypeDescription
OperationFuture<Empty,DeleteOperationMetadata>

deleteIndexCallable()

public final UnaryCallable<DeleteIndexRequest,Operation> deleteIndexCallable()

Deletes an Index. An Index can only be deleted when all its DeployedIndexes had been undeployed.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   DeleteIndexRequest request =
       DeleteIndexRequest.newBuilder()
           .setName(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString())
           .build();
   ApiFuture<Operation> future = indexServiceClient.deleteIndexCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteIndexRequest,Operation>

deleteIndexOperationCallable()

public final OperationCallable<DeleteIndexRequest,Empty,DeleteOperationMetadata> deleteIndexOperationCallable()

Deletes an Index. An Index can only be deleted when all its DeployedIndexes had been undeployed.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   DeleteIndexRequest request =
       DeleteIndexRequest.newBuilder()
           .setName(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString())
           .build();
   OperationFuture<Empty, DeleteOperationMetadata> future =
       indexServiceClient.deleteIndexOperationCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
OperationCallable<DeleteIndexRequest,Empty,DeleteOperationMetadata>

getIamPolicy(GetIamPolicyRequest request)

public final Policy getIamPolicy(GetIamPolicyRequest request)

Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   GetIamPolicyRequest request =
       GetIamPolicyRequest.newBuilder()
           .setResource(
               EndpointName.ofProjectLocationEndpointName(
                       "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
                   .toString())
           .setOptions(GetPolicyOptions.newBuilder().build())
           .build();
   Policy response = indexServiceClient.getIamPolicy(request);
 }
 
Parameter
NameDescription
requestcom.google.iam.v1.GetIamPolicyRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
com.google.iam.v1.Policy

getIamPolicyCallable()

public final UnaryCallable<GetIamPolicyRequest,Policy> getIamPolicyCallable()

Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   GetIamPolicyRequest request =
       GetIamPolicyRequest.newBuilder()
           .setResource(
               EndpointName.ofProjectLocationEndpointName(
                       "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
                   .toString())
           .setOptions(GetPolicyOptions.newBuilder().build())
           .build();
   ApiFuture<Policy> future = indexServiceClient.getIamPolicyCallable().futureCall(request);
   // Do something.
   Policy response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy>

getIndex(GetIndexRequest request)

public final Index getIndex(GetIndexRequest request)

Gets an Index.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   GetIndexRequest request =
       GetIndexRequest.newBuilder()
           .setName(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString())
           .build();
   Index response = indexServiceClient.getIndex(request);
 }
 
Parameter
NameDescription
requestGetIndexRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
Index

getIndex(IndexName name)

public final Index getIndex(IndexName name)

Gets an Index.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   IndexName name = IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]");
   Index response = indexServiceClient.getIndex(name);
 }
 
Parameter
NameDescription
nameIndexName

Required. The name of the Index resource. Format: projects/{project}/locations/{location}/indexes/{index}

Returns
TypeDescription
Index

getIndex(String name)

public final Index getIndex(String name)

Gets an Index.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   String name = IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString();
   Index response = indexServiceClient.getIndex(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the Index resource. Format: projects/{project}/locations/{location}/indexes/{index}

Returns
TypeDescription
Index

getIndexCallable()

public final UnaryCallable<GetIndexRequest,Index> getIndexCallable()

Gets an Index.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   GetIndexRequest request =
       GetIndexRequest.newBuilder()
           .setName(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString())
           .build();
   ApiFuture<Index> future = indexServiceClient.getIndexCallable().futureCall(request);
   // Do something.
   Index response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetIndexRequest,Index>

getLocation(GetLocationRequest request)

public final Location getLocation(GetLocationRequest request)

Gets information about a location.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   Location response = indexServiceClient.getLocation(request);
 }
 
Parameter
NameDescription
requestcom.google.cloud.location.GetLocationRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
com.google.cloud.location.Location

getLocationCallable()

public final UnaryCallable<GetLocationRequest,Location> getLocationCallable()

Gets information about a location.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   ApiFuture<Location> future = indexServiceClient.getLocationCallable().futureCall(request);
   // Do something.
   Location response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location>

getOperationsClient()

public final OperationsClient getOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
TypeDescription
OperationsClient

getSettings()

public final IndexServiceSettings getSettings()
Returns
TypeDescription
IndexServiceSettings

getStub()

public IndexServiceStub getStub()
Returns
TypeDescription
IndexServiceStub

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

listIndexes(ListIndexesRequest request)

public final IndexServiceClient.ListIndexesPagedResponse listIndexes(ListIndexesRequest request)

Lists Indexes in a Location.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   ListIndexesRequest request =
       ListIndexesRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setReadMask(FieldMask.newBuilder().build())
           .build();
   for (Index element : indexServiceClient.listIndexes(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListIndexesRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
IndexServiceClient.ListIndexesPagedResponse

listIndexes(LocationName parent)

public final IndexServiceClient.ListIndexesPagedResponse listIndexes(LocationName parent)

Lists Indexes in a Location.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   for (Index element : indexServiceClient.listIndexes(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentLocationName

Required. The resource name of the Location from which to list the Indexes. Format: projects/{project}/locations/{location}

Returns
TypeDescription
IndexServiceClient.ListIndexesPagedResponse

listIndexes(String parent)

public final IndexServiceClient.ListIndexesPagedResponse listIndexes(String parent)

Lists Indexes in a Location.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   for (Index element : indexServiceClient.listIndexes(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentString

Required. The resource name of the Location from which to list the Indexes. Format: projects/{project}/locations/{location}

Returns
TypeDescription
IndexServiceClient.ListIndexesPagedResponse

listIndexesCallable()

public final UnaryCallable<ListIndexesRequest,ListIndexesResponse> listIndexesCallable()

Lists Indexes in a Location.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   ListIndexesRequest request =
       ListIndexesRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setReadMask(FieldMask.newBuilder().build())
           .build();
   while (true) {
     ListIndexesResponse response = indexServiceClient.listIndexesCallable().call(request);
     for (Index element : response.getIndexesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListIndexesRequest,ListIndexesResponse>

listIndexesPagedCallable()

public final UnaryCallable<ListIndexesRequest,IndexServiceClient.ListIndexesPagedResponse> listIndexesPagedCallable()

Lists Indexes in a Location.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   ListIndexesRequest request =
       ListIndexesRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setReadMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<Index> future = indexServiceClient.listIndexesPagedCallable().futureCall(request);
   // Do something.
   for (Index element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListIndexesRequest,ListIndexesPagedResponse>

listLocations(ListLocationsRequest request)

public final IndexServiceClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request)

Lists information about the supported locations for this service.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Location element : indexServiceClient.listLocations(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestcom.google.cloud.location.ListLocationsRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
IndexServiceClient.ListLocationsPagedResponse

listLocationsCallable()

public final UnaryCallable<ListLocationsRequest,ListLocationsResponse> listLocationsCallable()

Lists information about the supported locations for this service.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListLocationsResponse response = indexServiceClient.listLocationsCallable().call(request);
     for (Location element : response.getLocationsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse>

listLocationsPagedCallable()

public final UnaryCallable<ListLocationsRequest,IndexServiceClient.ListLocationsPagedResponse> listLocationsPagedCallable()

Lists information about the supported locations for this service.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<Location> future =
       indexServiceClient.listLocationsPagedCallable().futureCall(request);
   // Do something.
   for (Location element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse>

removeDatapoints(RemoveDatapointsRequest request)

public final RemoveDatapointsResponse removeDatapoints(RemoveDatapointsRequest request)

Remove Datapoints from an Index.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   RemoveDatapointsRequest request =
       RemoveDatapointsRequest.newBuilder()
           .setIndex(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString())
           .addAllDatapointIds(new ArrayList<String>())
           .build();
   RemoveDatapointsResponse response = indexServiceClient.removeDatapoints(request);
 }
 
Parameter
NameDescription
requestRemoveDatapointsRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
RemoveDatapointsResponse

removeDatapointsCallable()

public final UnaryCallable<RemoveDatapointsRequest,RemoveDatapointsResponse> removeDatapointsCallable()

Remove Datapoints from an Index.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   RemoveDatapointsRequest request =
       RemoveDatapointsRequest.newBuilder()
           .setIndex(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString())
           .addAllDatapointIds(new ArrayList<String>())
           .build();
   ApiFuture<RemoveDatapointsResponse> future =
       indexServiceClient.removeDatapointsCallable().futureCall(request);
   // Do something.
   RemoveDatapointsResponse response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<RemoveDatapointsRequest,RemoveDatapointsResponse>

setIamPolicy(SetIamPolicyRequest request)

public final Policy setIamPolicy(SetIamPolicyRequest request)

Sets the access control policy on the specified resource. Replacesany existing policy.

Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIEDerrors.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   SetIamPolicyRequest request =
       SetIamPolicyRequest.newBuilder()
           .setResource(
               EndpointName.ofProjectLocationEndpointName(
                       "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
                   .toString())
           .setPolicy(Policy.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   Policy response = indexServiceClient.setIamPolicy(request);
 }
 
Parameter
NameDescription
requestcom.google.iam.v1.SetIamPolicyRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
com.google.iam.v1.Policy

setIamPolicyCallable()

public final UnaryCallable<SetIamPolicyRequest,Policy> setIamPolicyCallable()

Sets the access control policy on the specified resource. Replacesany existing policy.

Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIEDerrors.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   SetIamPolicyRequest request =
       SetIamPolicyRequest.newBuilder()
           .setResource(
               EndpointName.ofProjectLocationEndpointName(
                       "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
                   .toString())
           .setPolicy(Policy.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<Policy> future = indexServiceClient.setIamPolicyCallable().futureCall(request);
   // Do something.
   Policy response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

testIamPermissions(TestIamPermissionsRequest request)

public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request)

Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a NOT_FOUND error.

Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   TestIamPermissionsRequest request =
       TestIamPermissionsRequest.newBuilder()
           .setResource(
               EndpointName.ofProjectLocationEndpointName(
                       "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
                   .toString())
           .addAllPermissions(new ArrayList<String>())
           .build();
   TestIamPermissionsResponse response = indexServiceClient.testIamPermissions(request);
 }
 
Parameter
NameDescription
requestcom.google.iam.v1.TestIamPermissionsRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
com.google.iam.v1.TestIamPermissionsResponse

testIamPermissionsCallable()

public final UnaryCallable<TestIamPermissionsRequest,TestIamPermissionsResponse> testIamPermissionsCallable()

Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a NOT_FOUND error.

Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   TestIamPermissionsRequest request =
       TestIamPermissionsRequest.newBuilder()
           .setResource(
               EndpointName.ofProjectLocationEndpointName(
                       "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
                   .toString())
           .addAllPermissions(new ArrayList<String>())
           .build();
   ApiFuture<TestIamPermissionsResponse> future =
       indexServiceClient.testIamPermissionsCallable().futureCall(request);
   // Do something.
   TestIamPermissionsResponse response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse>

updateIndexAsync(Index index, FieldMask updateMask)

public final OperationFuture<Index,UpdateIndexOperationMetadata> updateIndexAsync(Index index, FieldMask updateMask)

Updates an Index.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   Index index = Index.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   Index response = indexServiceClient.updateIndexAsync(index, updateMask).get();
 }
 
Parameters
NameDescription
indexIndex

Required. The Index which updates the resource on the server.

updateMaskFieldMask

The update mask applies to the resource. For the FieldMask definition, see google.protobuf.FieldMask.

Returns
TypeDescription
OperationFuture<Index,UpdateIndexOperationMetadata>

updateIndexAsync(UpdateIndexRequest request)

public final OperationFuture<Index,UpdateIndexOperationMetadata> updateIndexAsync(UpdateIndexRequest request)

Updates an Index.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   UpdateIndexRequest request =
       UpdateIndexRequest.newBuilder()
           .setIndex(Index.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   Index response = indexServiceClient.updateIndexAsync(request).get();
 }
 
Parameter
NameDescription
requestUpdateIndexRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Index,UpdateIndexOperationMetadata>

updateIndexCallable()

public final UnaryCallable<UpdateIndexRequest,Operation> updateIndexCallable()

Updates an Index.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   UpdateIndexRequest request =
       UpdateIndexRequest.newBuilder()
           .setIndex(Index.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<Operation> future = indexServiceClient.updateIndexCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpdateIndexRequest,Operation>

updateIndexOperationCallable()

public final OperationCallable<UpdateIndexRequest,Index,UpdateIndexOperationMetadata> updateIndexOperationCallable()

Updates an Index.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   UpdateIndexRequest request =
       UpdateIndexRequest.newBuilder()
           .setIndex(Index.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   OperationFuture<Index, UpdateIndexOperationMetadata> future =
       indexServiceClient.updateIndexOperationCallable().futureCall(request);
   // Do something.
   Index response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<UpdateIndexRequest,Index,UpdateIndexOperationMetadata>

upsertDatapoints(UpsertDatapointsRequest request)

public final UpsertDatapointsResponse upsertDatapoints(UpsertDatapointsRequest request)

Add/update Datapoints into an Index.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   UpsertDatapointsRequest request =
       UpsertDatapointsRequest.newBuilder()
           .setIndex(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString())
           .addAllDatapoints(new ArrayList<IndexDatapoint>())
           .build();
   UpsertDatapointsResponse response = indexServiceClient.upsertDatapoints(request);
 }
 
Parameter
NameDescription
requestUpsertDatapointsRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
UpsertDatapointsResponse

upsertDatapointsCallable()

public final UnaryCallable<UpsertDatapointsRequest,UpsertDatapointsResponse> upsertDatapointsCallable()

Add/update Datapoints into an Index.

Sample code:


 // 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_library
 try (IndexServiceClient indexServiceClient = IndexServiceClient.create()) {
   UpsertDatapointsRequest request =
       UpsertDatapointsRequest.newBuilder()
           .setIndex(IndexName.of("[PROJECT]", "[LOCATION]", "[INDEX]").toString())
           .addAllDatapoints(new ArrayList<IndexDatapoint>())
           .build();
   ApiFuture<UpsertDatapointsResponse> future =
       indexServiceClient.upsertDatapointsCallable().futureCall(request);
   // Do something.
   UpsertDatapointsResponse response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpsertDatapointsRequest,UpsertDatapointsResponse>