Vector Search v1 API - Class DataObjectSearchServiceClient (1.0.0-beta01)

public abstract class DataObjectSearchServiceClient

Reference documentation and code samples for the Vector Search v1 API class DataObjectSearchServiceClient.

DataObjectSearchService client wrapper, for convenient use.

Inheritance

object > DataObjectSearchServiceClient

Namespace

Google.Cloud.VectorSearch.V1

Assembly

Google.Cloud.VectorSearch.V1.dll

Remarks

Service for searching data objects.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the DataObjectSearchService service, which is a host of "vectorsearch.googleapis.com" and a port of 443.

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default DataObjectSearchService scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

The default DataObjectSearchService scopes are:

GrpcClient

public virtual DataObjectSearchService.DataObjectSearchServiceClient GrpcClient { get; }

The underlying gRPC DataObjectSearchService client

Property Value
Type Description
DataObjectSearchServiceDataObjectSearchServiceClient

LocationsClient

public virtual LocationsClient LocationsClient { get; }

The LocationsClient associated with this client.

Property Value
Type Description
LocationsClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

Methods

AggregateDataObjects(AggregateDataObjectsRequest, CallSettings)

public virtual AggregateDataObjectsResponse AggregateDataObjects(AggregateDataObjectsRequest request, CallSettings callSettings = null)

Aggregates data objects.

Parameters
Name Description
request AggregateDataObjectsRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
AggregateDataObjectsResponse

The RPC response.

Example
// Create client
DataObjectSearchServiceClient dataObjectSearchServiceClient = DataObjectSearchServiceClient.Create();
// Initialize request argument(s)
AggregateDataObjectsRequest request = new AggregateDataObjectsRequest
{
    ParentAsCollectionName = CollectionName.FromProjectLocationCollection("[PROJECT]", "[LOCATION]", "[COLLECTION]"),
    Filter = new Struct(),
    Aggregate = AggregationMethod.Unspecified,
};
// Make the request
AggregateDataObjectsResponse response = dataObjectSearchServiceClient.AggregateDataObjects(request);

AggregateDataObjectsAsync(AggregateDataObjectsRequest, CallSettings)

public virtual Task<AggregateDataObjectsResponse> AggregateDataObjectsAsync(AggregateDataObjectsRequest request, CallSettings callSettings = null)

Aggregates data objects.

Parameters
Name Description
request AggregateDataObjectsRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAggregateDataObjectsResponse

A Task containing the RPC response.

Example
// Create client
DataObjectSearchServiceClient dataObjectSearchServiceClient = await DataObjectSearchServiceClient.CreateAsync();
// Initialize request argument(s)
AggregateDataObjectsRequest request = new AggregateDataObjectsRequest
{
    ParentAsCollectionName = CollectionName.FromProjectLocationCollection("[PROJECT]", "[LOCATION]", "[COLLECTION]"),
    Filter = new Struct(),
    Aggregate = AggregationMethod.Unspecified,
};
// Make the request
AggregateDataObjectsResponse response = await dataObjectSearchServiceClient.AggregateDataObjectsAsync(request);

AggregateDataObjectsAsync(AggregateDataObjectsRequest, CancellationToken)

public virtual Task<AggregateDataObjectsResponse> AggregateDataObjectsAsync(AggregateDataObjectsRequest request, CancellationToken cancellationToken)

Aggregates data objects.

Parameters
Name Description
request AggregateDataObjectsRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAggregateDataObjectsResponse

A Task containing the RPC response.

Example
// Create client
DataObjectSearchServiceClient dataObjectSearchServiceClient = await DataObjectSearchServiceClient.CreateAsync();
// Initialize request argument(s)
AggregateDataObjectsRequest request = new AggregateDataObjectsRequest
{
    ParentAsCollectionName = CollectionName.FromProjectLocationCollection("[PROJECT]", "[LOCATION]", "[COLLECTION]"),
    Filter = new Struct(),
    Aggregate = AggregationMethod.Unspecified,
};
// Make the request
AggregateDataObjectsResponse response = await dataObjectSearchServiceClient.AggregateDataObjectsAsync(request);

BatchSearchDataObjects(BatchSearchDataObjectsRequest, CallSettings)

public virtual BatchSearchDataObjectsResponse BatchSearchDataObjects(BatchSearchDataObjectsRequest request, CallSettings callSettings = null)

Batch searches data objects.

Parameters
Name Description
request BatchSearchDataObjectsRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
BatchSearchDataObjectsResponse

The RPC response.

Example
// Create client
DataObjectSearchServiceClient dataObjectSearchServiceClient = DataObjectSearchServiceClient.Create();
// Initialize request argument(s)
BatchSearchDataObjectsRequest request = new BatchSearchDataObjectsRequest
{
    ParentAsCollectionName = CollectionName.FromProjectLocationCollection("[PROJECT]", "[LOCATION]", "[COLLECTION]"),
    Searches = { new Search(), },
    Combine = new BatchSearchDataObjectsRequest.Types.CombineResultsOptions(),
};
// Make the request
BatchSearchDataObjectsResponse response = dataObjectSearchServiceClient.BatchSearchDataObjects(request);

BatchSearchDataObjectsAsync(BatchSearchDataObjectsRequest, CallSettings)

public virtual Task<BatchSearchDataObjectsResponse> BatchSearchDataObjectsAsync(BatchSearchDataObjectsRequest request, CallSettings callSettings = null)

Batch searches data objects.

Parameters
Name Description
request BatchSearchDataObjectsRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskBatchSearchDataObjectsResponse

A Task containing the RPC response.

Example
// Create client
DataObjectSearchServiceClient dataObjectSearchServiceClient = await DataObjectSearchServiceClient.CreateAsync();
// Initialize request argument(s)
BatchSearchDataObjectsRequest request = new BatchSearchDataObjectsRequest
{
    ParentAsCollectionName = CollectionName.FromProjectLocationCollection("[PROJECT]", "[LOCATION]", "[COLLECTION]"),
    Searches = { new Search(), },
    Combine = new BatchSearchDataObjectsRequest.Types.CombineResultsOptions(),
};
// Make the request
BatchSearchDataObjectsResponse response = await dataObjectSearchServiceClient.BatchSearchDataObjectsAsync(request);

BatchSearchDataObjectsAsync(BatchSearchDataObjectsRequest, CancellationToken)

public virtual Task<BatchSearchDataObjectsResponse> BatchSearchDataObjectsAsync(BatchSearchDataObjectsRequest request, CancellationToken cancellationToken)

Batch searches data objects.

Parameters
Name Description
request BatchSearchDataObjectsRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskBatchSearchDataObjectsResponse

A Task containing the RPC response.

Example
// Create client
DataObjectSearchServiceClient dataObjectSearchServiceClient = await DataObjectSearchServiceClient.CreateAsync();
// Initialize request argument(s)
BatchSearchDataObjectsRequest request = new BatchSearchDataObjectsRequest
{
    ParentAsCollectionName = CollectionName.FromProjectLocationCollection("[PROJECT]", "[LOCATION]", "[COLLECTION]"),
    Searches = { new Search(), },
    Combine = new BatchSearchDataObjectsRequest.Types.CombineResultsOptions(),
};
// Make the request
BatchSearchDataObjectsResponse response = await dataObjectSearchServiceClient.BatchSearchDataObjectsAsync(request);

Create()

public static DataObjectSearchServiceClient Create()

Synchronously creates a DataObjectSearchServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use DataObjectSearchServiceClientBuilder.

Returns
Type Description
DataObjectSearchServiceClient

The created DataObjectSearchServiceClient.

CreateAsync(CancellationToken)

public static Task<DataObjectSearchServiceClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a DataObjectSearchServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use DataObjectSearchServiceClientBuilder.

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskDataObjectSearchServiceClient

The task representing the created DataObjectSearchServiceClient.

QueryDataObjects(QueryDataObjectsRequest, CallSettings)

public virtual PagedEnumerable<QueryDataObjectsResponse, DataObject> QueryDataObjects(QueryDataObjectsRequest request, CallSettings callSettings = null)

Queries data objects.

Parameters
Name Description
request QueryDataObjectsRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableQueryDataObjectsResponseDataObject

A pageable sequence of DataObject resources.

Example
// Create client
DataObjectSearchServiceClient dataObjectSearchServiceClient = DataObjectSearchServiceClient.Create();
// Initialize request argument(s)
QueryDataObjectsRequest request = new QueryDataObjectsRequest
{
    ParentAsCollectionName = CollectionName.FromProjectLocationCollection("[PROJECT]", "[LOCATION]", "[COLLECTION]"),
    Filter = new Struct(),
    OutputFields = new OutputFields(),
};
// Make the request
PagedEnumerable<QueryDataObjectsResponse, DataObject> response = dataObjectSearchServiceClient.QueryDataObjects(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (DataObject item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (QueryDataObjectsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (DataObject item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<DataObject> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (DataObject item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

QueryDataObjectsAsync(QueryDataObjectsRequest, CallSettings)

public virtual PagedAsyncEnumerable<QueryDataObjectsResponse, DataObject> QueryDataObjectsAsync(QueryDataObjectsRequest request, CallSettings callSettings = null)

Queries data objects.

Parameters
Name Description
request QueryDataObjectsRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableQueryDataObjectsResponseDataObject

A pageable asynchronous sequence of DataObject resources.

Example
// Create client
DataObjectSearchServiceClient dataObjectSearchServiceClient = await DataObjectSearchServiceClient.CreateAsync();
// Initialize request argument(s)
QueryDataObjectsRequest request = new QueryDataObjectsRequest
{
    ParentAsCollectionName = CollectionName.FromProjectLocationCollection("[PROJECT]", "[LOCATION]", "[COLLECTION]"),
    Filter = new Struct(),
    OutputFields = new OutputFields(),
};
// Make the request
PagedAsyncEnumerable<QueryDataObjectsResponse, DataObject> response = dataObjectSearchServiceClient.QueryDataObjectsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await foreach (DataObject item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
await foreach (QueryDataObjectsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (DataObject item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<DataObject> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (DataObject item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

SearchDataObjects(SearchDataObjectsRequest, CallSettings)

public virtual PagedEnumerable<SearchDataObjectsResponse, SearchResult> SearchDataObjects(SearchDataObjectsRequest request, CallSettings callSettings = null)

Searches data objects.

Parameters
Name Description
request SearchDataObjectsRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableSearchDataObjectsResponseSearchResult

A pageable sequence of SearchResult resources.

Example
// Create client
DataObjectSearchServiceClient dataObjectSearchServiceClient = DataObjectSearchServiceClient.Create();
// Initialize request argument(s)
SearchDataObjectsRequest request = new SearchDataObjectsRequest
{
    ParentAsCollectionName = CollectionName.FromProjectLocationCollection("[PROJECT]", "[LOCATION]", "[COLLECTION]"),
    VectorSearch = new VectorSearch(),
};
// Make the request
PagedEnumerable<SearchDataObjectsResponse, SearchResult> response = dataObjectSearchServiceClient.SearchDataObjects(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (SearchResult item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (SearchDataObjectsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (SearchResult item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<SearchResult> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (SearchResult item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

SearchDataObjectsAsync(SearchDataObjectsRequest, CallSettings)

public virtual PagedAsyncEnumerable<SearchDataObjectsResponse, SearchResult> SearchDataObjectsAsync(SearchDataObjectsRequest request, CallSettings callSettings = null)

Searches data objects.

Parameters
Name Description
request SearchDataObjectsRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableSearchDataObjectsResponseSearchResult

A pageable asynchronous sequence of SearchResult resources.

Example
// Create client
DataObjectSearchServiceClient dataObjectSearchServiceClient = await DataObjectSearchServiceClient.CreateAsync();
// Initialize request argument(s)
SearchDataObjectsRequest request = new SearchDataObjectsRequest
{
    ParentAsCollectionName = CollectionName.FromProjectLocationCollection("[PROJECT]", "[LOCATION]", "[COLLECTION]"),
    VectorSearch = new VectorSearch(),
};
// Make the request
PagedAsyncEnumerable<SearchDataObjectsResponse, SearchResult> response = dataObjectSearchServiceClient.SearchDataObjectsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await foreach (SearchResult item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
await foreach (SearchDataObjectsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (SearchResult item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<SearchResult> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (SearchResult item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
Type Description
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.