Service for searching data objects. v1
Package
@google-cloud/vectorsearchConstructors
(constructor)(opts, gaxInstance)
constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);Construct an instance of DataObjectSearchServiceClient.
| Parameters | |
|---|---|
| Name | Description |
opts |
ClientOptions
|
gaxInstance |
typeof gax | typeof fallback
: loaded instance of |
Properties
apiEndpoint
get apiEndpoint(): string;The DNS address for this API service.
apiEndpoint
static get apiEndpoint(): string;The DNS address for this API service - same as servicePath.
auth
auth: gax.GoogleAuth;dataObjectSearchServiceStub
dataObjectSearchServiceStub?: Promise<{
[name: string]: Function;
}>;descriptors
descriptors: Descriptors;innerApiCalls
innerApiCalls: {
[name: string]: Function;
};locationsClient
locationsClient: LocationsClient;pathTemplates
pathTemplates: {
[name: string]: gax.PathTemplate;
};port
static get port(): number;The port for this API service.
scopes
static get scopes(): string[];The scopes needed to make gRPC calls for every method defined in this service.
servicePath
static get servicePath(): string;The DNS address for this API service.
universeDomain
get universeDomain(): string;warn
warn: (code: string, message: string, warnType?: string) => void;Methods
aggregateDataObjects(request, options)
aggregateDataObjects(request?: protos.google.cloud.vectorsearch.v1.IAggregateDataObjectsRequest, options?: CallOptions): Promise<[
protos.google.cloud.vectorsearch.v1.IAggregateDataObjectsResponse,
protos.google.cloud.vectorsearch.v1.IAggregateDataObjectsRequest | undefined,
{} | undefined
]>;Aggregates data objects.
| Parameters | |
|---|---|
| Name | Description |
request |
IAggregateDataObjectsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
Promise<[
protos.google.cloud.vectorsearch.v1.IAggregateDataObjectsResponse,
protos.google.cloud.vectorsearch.v1.IAggregateDataObjectsRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing AggregateDataObjectsResponse. Please see the documentation for more details and examples. |
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The resource name of the Collection for which to query.
* Format: `projects/{project}/locations/{location}/collections/{collection}`
*/
// const parent = 'abc123'
/**
* Optional. A JSON filter expression, e.g. {"genre": {"$eq": "sci-fi"}},
* represented as a google.protobuf.Struct.
*/
// const filter = {}
/**
* Required. The aggregation method to apply to the query.
*/
// const aggregate = {}
// Imports the Vectorsearch library
const {DataObjectSearchServiceClient} = require('@google-cloud/vectorsearch').v1;
// Instantiates a client
const vectorsearchClient = new DataObjectSearchServiceClient();
async function callAggregateDataObjects() {
// Construct request
const request = {
parent,
aggregate,
};
// Run request
const response = await vectorsearchClient.aggregateDataObjects(request);
console.log(response);
}
callAggregateDataObjects();
aggregateDataObjects(request, options, callback)
aggregateDataObjects(request: protos.google.cloud.vectorsearch.v1.IAggregateDataObjectsRequest, options: CallOptions, callback: Callback<protos.google.cloud.vectorsearch.v1.IAggregateDataObjectsResponse, protos.google.cloud.vectorsearch.v1.IAggregateDataObjectsRequest | null | undefined, {} | null | undefined>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IAggregateDataObjectsRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.cloud.vectorsearch.v1.IAggregateDataObjectsResponse, protos.google.cloud.vectorsearch.v1.IAggregateDataObjectsRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
aggregateDataObjects(request, callback)
aggregateDataObjects(request: protos.google.cloud.vectorsearch.v1.IAggregateDataObjectsRequest, callback: Callback<protos.google.cloud.vectorsearch.v1.IAggregateDataObjectsResponse, protos.google.cloud.vectorsearch.v1.IAggregateDataObjectsRequest | null | undefined, {} | null | undefined>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IAggregateDataObjectsRequest
|
callback |
Callback<protos.google.cloud.vectorsearch.v1.IAggregateDataObjectsResponse, protos.google.cloud.vectorsearch.v1.IAggregateDataObjectsRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
batchSearchDataObjects(request, options)
batchSearchDataObjects(request?: protos.google.cloud.vectorsearch.v1.IBatchSearchDataObjectsRequest, options?: CallOptions): Promise<[
protos.google.cloud.vectorsearch.v1.IBatchSearchDataObjectsResponse,
protos.google.cloud.vectorsearch.v1.IBatchSearchDataObjectsRequest | undefined,
{} | undefined
]>;Batch searches data objects.
| Parameters | |
|---|---|
| Name | Description |
request |
IBatchSearchDataObjectsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
Promise<[
protos.google.cloud.vectorsearch.v1.IBatchSearchDataObjectsResponse,
protos.google.cloud.vectorsearch.v1.IBatchSearchDataObjectsRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing BatchSearchDataObjectsResponse. Please see the documentation for more details and examples. |
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The resource name of the Collection for which to search.
* Format: `projects/{project}/locations/{location}/collections/{collection}`
*/
// const parent = 'abc123'
/**
* Required. A list of search requests to execute in parallel.
*/
// const searches = [1,2,3,4]
/**
* Optional. Options for combining the results of the batch search operations.
*/
// const combine = {}
// Imports the Vectorsearch library
const {DataObjectSearchServiceClient} = require('@google-cloud/vectorsearch').v1;
// Instantiates a client
const vectorsearchClient = new DataObjectSearchServiceClient();
async function callBatchSearchDataObjects() {
// Construct request
const request = {
parent,
searches,
};
// Run request
const response = await vectorsearchClient.batchSearchDataObjects(request);
console.log(response);
}
callBatchSearchDataObjects();
batchSearchDataObjects(request, options, callback)
batchSearchDataObjects(request: protos.google.cloud.vectorsearch.v1.IBatchSearchDataObjectsRequest, options: CallOptions, callback: Callback<protos.google.cloud.vectorsearch.v1.IBatchSearchDataObjectsResponse, protos.google.cloud.vectorsearch.v1.IBatchSearchDataObjectsRequest | null | undefined, {} | null | undefined>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IBatchSearchDataObjectsRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.cloud.vectorsearch.v1.IBatchSearchDataObjectsResponse, protos.google.cloud.vectorsearch.v1.IBatchSearchDataObjectsRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
batchSearchDataObjects(request, callback)
batchSearchDataObjects(request: protos.google.cloud.vectorsearch.v1.IBatchSearchDataObjectsRequest, callback: Callback<protos.google.cloud.vectorsearch.v1.IBatchSearchDataObjectsResponse, protos.google.cloud.vectorsearch.v1.IBatchSearchDataObjectsRequest | null | undefined, {} | null | undefined>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IBatchSearchDataObjectsRequest
|
callback |
Callback<protos.google.cloud.vectorsearch.v1.IBatchSearchDataObjectsResponse, protos.google.cloud.vectorsearch.v1.IBatchSearchDataObjectsRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
close()
close(): Promise<void>;Terminate the gRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
| Returns | |
|---|---|
| Type | Description |
Promise<void> |
{Promise} A promise that resolves when the client is closed. |
collectionPath(project, location, collection)
collectionPath(project: string, location: string, collection: string): string;Return a fully-qualified collection resource name string.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
collection |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
{string} Resource name string. |
dataObjectPath(project, location, collection, dataObject)
dataObjectPath(project: string, location: string, collection: string, dataObject: string): string;Return a fully-qualified dataObject resource name string.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
collection |
string
|
dataObject |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
{string} Resource name string. |
getLocation(request, options, callback)
getLocation(request: LocationProtos.google.cloud.location.IGetLocationRequest, options?: gax.CallOptions | Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>, callback?: Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>): Promise<LocationProtos.google.cloud.location.ILocation>;Gets information about a location.
| Parameters | |
|---|---|
| Name | Description |
request |
LocationProtos.google.cloud.location.IGetLocationRequest
The request object that will be sent. |
options |
CallOptions | Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>
Call options. See CallOptions for more details. |
callback |
Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
Promise<google.cloud.location.ILocation> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
const [response] = await client.getLocation(request);
getProjectId()
getProjectId(): Promise<string>;| Returns | |
|---|---|
| Type | Description |
Promise<string> |
|
getProjectId(callback)
getProjectId(callback: Callback<string, undefined, undefined>): void;| Parameter | |
|---|---|
| Name | Description |
callback |
Callback<string, undefined, undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
indexPath(project, location, collection, index)
indexPath(project: string, location: string, collection: string, index: string): string;Return a fully-qualified index resource name string.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
collection |
string
|
index |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
{string} Resource name string. |
initialize()
initialize(): Promise<{
[name: string]: Function;
}>;Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.
You can await on this method if you want to make sure the client is initialized.
| Returns | |
|---|---|
| Type | Description |
Promise<{
[name: string]: Function;
}> |
{Promise} A promise that resolves to an authenticated service stub. |
listLocationsAsync(request, options)
listLocationsAsync(request: LocationProtos.google.cloud.location.IListLocationsRequest, options?: CallOptions): AsyncIterable<LocationProtos.google.cloud.location.ILocation>;Lists information about the supported locations for this service. Returns an iterable object.
for-await-of syntax is used with the iterable to get response elements on-demand.
| Parameters | |
|---|---|
| Name | Description |
request |
LocationProtos.google.cloud.location.IListLocationsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
AsyncIterable<google.cloud.location.ILocation> |
{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples. |
const iterable = client.listLocationsAsync(request);
for await (const response of iterable) {
// process response
}
matchCollectionFromCollectionName(collectionName)
matchCollectionFromCollectionName(collectionName: string): string | number;Parse the collection from Collection resource.
| Parameter | |
|---|---|
| Name | Description |
collectionName |
string
A fully-qualified path representing Collection resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the collection. |
matchCollectionFromDataObjectName(dataObjectName)
matchCollectionFromDataObjectName(dataObjectName: string): string | number;Parse the collection from DataObject resource.
| Parameter | |
|---|---|
| Name | Description |
dataObjectName |
string
A fully-qualified path representing DataObject resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the collection. |
matchCollectionFromIndexName(indexName)
matchCollectionFromIndexName(indexName: string): string | number;Parse the collection from Index resource.
| Parameter | |
|---|---|
| Name | Description |
indexName |
string
A fully-qualified path representing Index resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the collection. |
matchDataObjectFromDataObjectName(dataObjectName)
matchDataObjectFromDataObjectName(dataObjectName: string): string | number;Parse the dataObject from DataObject resource.
| Parameter | |
|---|---|
| Name | Description |
dataObjectName |
string
A fully-qualified path representing DataObject resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the dataObject. |
matchIndexFromIndexName(indexName)
matchIndexFromIndexName(indexName: string): string | number;Parse the index from Index resource.
| Parameter | |
|---|---|
| Name | Description |
indexName |
string
A fully-qualified path representing Index resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the index. |
matchLocationFromCollectionName(collectionName)
matchLocationFromCollectionName(collectionName: string): string | number;Parse the location from Collection resource.
| Parameter | |
|---|---|
| Name | Description |
collectionName |
string
A fully-qualified path representing Collection resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the location. |
matchLocationFromDataObjectName(dataObjectName)
matchLocationFromDataObjectName(dataObjectName: string): string | number;Parse the location from DataObject resource.
| Parameter | |
|---|---|
| Name | Description |
dataObjectName |
string
A fully-qualified path representing DataObject resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the location. |
matchLocationFromIndexName(indexName)
matchLocationFromIndexName(indexName: string): string | number;Parse the location from Index resource.
| Parameter | |
|---|---|
| Name | Description |
indexName |
string
A fully-qualified path representing Index resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the location. |
matchProjectFromCollectionName(collectionName)
matchProjectFromCollectionName(collectionName: string): string | number;Parse the project from Collection resource.
| Parameter | |
|---|---|
| Name | Description |
collectionName |
string
A fully-qualified path representing Collection resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the project. |
matchProjectFromDataObjectName(dataObjectName)
matchProjectFromDataObjectName(dataObjectName: string): string | number;Parse the project from DataObject resource.
| Parameter | |
|---|---|
| Name | Description |
dataObjectName |
string
A fully-qualified path representing DataObject resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the project. |
matchProjectFromIndexName(indexName)
matchProjectFromIndexName(indexName: string): string | number;Parse the project from Index resource.
| Parameter | |
|---|---|
| Name | Description |
indexName |
string
A fully-qualified path representing Index resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the project. |
queryDataObjects(request, options)
queryDataObjects(request?: protos.google.cloud.vectorsearch.v1.IQueryDataObjectsRequest, options?: CallOptions): Promise<[
protos.google.cloud.vectorsearch.v1.IDataObject[],
protos.google.cloud.vectorsearch.v1.IQueryDataObjectsRequest | null,
protos.google.cloud.vectorsearch.v1.IQueryDataObjectsResponse
]>;Queries data objects.
| Parameters | |
|---|---|
| Name | Description |
request |
IQueryDataObjectsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
Promise<[
protos.google.cloud.vectorsearch.v1.IDataObject[],
protos.google.cloud.vectorsearch.v1.IQueryDataObjectsRequest | null,
protos.google.cloud.vectorsearch.v1.IQueryDataObjectsResponse
]> |
{Promise} - The promise which resolves to an array. The first element of the array is Array of DataObject. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using |
queryDataObjects(request, options, callback)
queryDataObjects(request: protos.google.cloud.vectorsearch.v1.IQueryDataObjectsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.vectorsearch.v1.IQueryDataObjectsRequest, protos.google.cloud.vectorsearch.v1.IQueryDataObjectsResponse | null | undefined, protos.google.cloud.vectorsearch.v1.IDataObject>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IQueryDataObjectsRequest
|
options |
CallOptions
|
callback |
PaginationCallback<protos.google.cloud.vectorsearch.v1.IQueryDataObjectsRequest, protos.google.cloud.vectorsearch.v1.IQueryDataObjectsResponse | null | undefined, protos.google.cloud.vectorsearch.v1.IDataObject>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
queryDataObjects(request, callback)
queryDataObjects(request: protos.google.cloud.vectorsearch.v1.IQueryDataObjectsRequest, callback: PaginationCallback<protos.google.cloud.vectorsearch.v1.IQueryDataObjectsRequest, protos.google.cloud.vectorsearch.v1.IQueryDataObjectsResponse | null | undefined, protos.google.cloud.vectorsearch.v1.IDataObject>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IQueryDataObjectsRequest
|
callback |
PaginationCallback<protos.google.cloud.vectorsearch.v1.IQueryDataObjectsRequest, protos.google.cloud.vectorsearch.v1.IQueryDataObjectsResponse | null | undefined, protos.google.cloud.vectorsearch.v1.IDataObject>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
queryDataObjectsAsync(request, options)
queryDataObjectsAsync(request?: protos.google.cloud.vectorsearch.v1.IQueryDataObjectsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.vectorsearch.v1.IDataObject>;Equivalent to queryDataObjects, but returns an iterable object.
for-await-of syntax is used with the iterable to get response elements on-demand.
| Parameters | |
|---|---|
| Name | Description |
request |
IQueryDataObjectsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
AsyncIterable<protos.google.cloud.vectorsearch.v1.IDataObject> |
{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing DataObject. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples. |
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The resource name of the Collection for which to query.
* Format: `projects/{project}/locations/{location}/collections/{collection}`
*/
// const parent = 'abc123'
/**
* Optional. A JSON filter expression, e.g. {"genre": {"$eq": "sci-fi"}},
* represented as a google.protobuf.Struct.
*/
// const filter = {}
/**
* Optional. Mask specifying which fields to return.
*/
// const outputFields = {}
/**
* Optional. The standard list page size. Default is 100.
* The maximum value is 1000; values above 1000 will be coerced to 1000.
*/
// const pageSize = 1234
/**
* Optional. The standard list page token.
* Typically obtained via
* QueryDataObjectsResponse.next_page_token google.cloud.vectorsearch.v1.QueryDataObjectsResponse.next_page_token
* of the previous
* DataObjectSearchService.QueryDataObjects google.cloud.vectorsearch.v1.DataObjectSearchService.QueryDataObjects
* call.
*/
// const pageToken = 'abc123'
// Imports the Vectorsearch library
const {DataObjectSearchServiceClient} = require('@google-cloud/vectorsearch').v1;
// Instantiates a client
const vectorsearchClient = new DataObjectSearchServiceClient();
async function callQueryDataObjects() {
// Construct request
const request = {
parent,
};
// Run request
const iterable = vectorsearchClient.queryDataObjectsAsync(request);
for await (const response of iterable) {
console.log(response);
}
}
callQueryDataObjects();
queryDataObjectsStream(request, options)
queryDataObjectsStream(request?: protos.google.cloud.vectorsearch.v1.IQueryDataObjectsRequest, options?: CallOptions): Transform;Equivalent to queryDataObjects, but returns a NodeJS Stream object.
| Parameters | |
|---|---|
| Name | Description |
request |
IQueryDataObjectsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
Transform |
{Stream} An object stream which emits an object representing DataObject on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using |
searchDataObjects(request, options)
searchDataObjects(request?: protos.google.cloud.vectorsearch.v1.ISearchDataObjectsRequest, options?: CallOptions): Promise<[
protos.google.cloud.vectorsearch.v1.ISearchResult[],
protos.google.cloud.vectorsearch.v1.ISearchDataObjectsRequest | null,
protos.google.cloud.vectorsearch.v1.ISearchDataObjectsResponse
]>;Searches data objects.
| Parameters | |
|---|---|
| Name | Description |
request |
ISearchDataObjectsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
Promise<[
protos.google.cloud.vectorsearch.v1.ISearchResult[],
protos.google.cloud.vectorsearch.v1.ISearchDataObjectsRequest | null,
protos.google.cloud.vectorsearch.v1.ISearchDataObjectsResponse
]> |
{Promise} - The promise which resolves to an array. The first element of the array is Array of SearchResult. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using |
searchDataObjects(request, options, callback)
searchDataObjects(request: protos.google.cloud.vectorsearch.v1.ISearchDataObjectsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.vectorsearch.v1.ISearchDataObjectsRequest, protos.google.cloud.vectorsearch.v1.ISearchDataObjectsResponse | null | undefined, protos.google.cloud.vectorsearch.v1.ISearchResult>): void;| Parameters | |
|---|---|
| Name | Description |
request |
ISearchDataObjectsRequest
|
options |
CallOptions
|
callback |
PaginationCallback<protos.google.cloud.vectorsearch.v1.ISearchDataObjectsRequest, protos.google.cloud.vectorsearch.v1.ISearchDataObjectsResponse | null | undefined, protos.google.cloud.vectorsearch.v1.ISearchResult>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
searchDataObjects(request, callback)
searchDataObjects(request: protos.google.cloud.vectorsearch.v1.ISearchDataObjectsRequest, callback: PaginationCallback<protos.google.cloud.vectorsearch.v1.ISearchDataObjectsRequest, protos.google.cloud.vectorsearch.v1.ISearchDataObjectsResponse | null | undefined, protos.google.cloud.vectorsearch.v1.ISearchResult>): void;| Parameters | |
|---|---|
| Name | Description |
request |
ISearchDataObjectsRequest
|
callback |
PaginationCallback<protos.google.cloud.vectorsearch.v1.ISearchDataObjectsRequest, protos.google.cloud.vectorsearch.v1.ISearchDataObjectsResponse | null | undefined, protos.google.cloud.vectorsearch.v1.ISearchResult>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
searchDataObjectsAsync(request, options)
searchDataObjectsAsync(request?: protos.google.cloud.vectorsearch.v1.ISearchDataObjectsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.vectorsearch.v1.ISearchResult>;Equivalent to searchDataObjects, but returns an iterable object.
for-await-of syntax is used with the iterable to get response elements on-demand.
| Parameters | |
|---|---|
| Name | Description |
request |
ISearchDataObjectsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
AsyncIterable<protos.google.cloud.vectorsearch.v1.ISearchResult> |
{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing SearchResult. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples. |
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* A vector search operation.
*/
// const vectorSearch = {}
/**
* A semantic search operation.
*/
// const semanticSearch = {}
/**
* Optional. A text search operation.
*/
// const textSearch = {}
/**
* Required. The resource name of the Collection for which to search.
* Format: `projects/{project}/locations/{location}/collections/{collection}`
*/
// const parent = 'abc123'
/**
* Optional. The standard list page size. Only supported for KNN. If not set,
* up to search_type.top_k results will be returned. The maximum value is
* 1000; values above 1000 will be coerced to 1000.
*/
// const pageSize = 1234
/**
* Optional. The standard list page token.
* Typically obtained via
* SearchDataObjectsResponse.next_page_token google.cloud.vectorsearch.v1.SearchDataObjectsResponse.next_page_token
* of the previous
* DataObjectSearchService.SearchDataObjects google.cloud.vectorsearch.v1.DataObjectSearchService.SearchDataObjects
* call.
*/
// const pageToken = 'abc123'
// Imports the Vectorsearch library
const {DataObjectSearchServiceClient} = require('@google-cloud/vectorsearch').v1;
// Instantiates a client
const vectorsearchClient = new DataObjectSearchServiceClient();
async function callSearchDataObjects() {
// Construct request
const request = {
parent,
};
// Run request
const iterable = vectorsearchClient.searchDataObjectsAsync(request);
for await (const response of iterable) {
console.log(response);
}
}
callSearchDataObjects();
searchDataObjectsStream(request, options)
searchDataObjectsStream(request?: protos.google.cloud.vectorsearch.v1.ISearchDataObjectsRequest, options?: CallOptions): Transform;Equivalent to searchDataObjects, but returns a NodeJS Stream object.
| Parameters | |
|---|---|
| Name | Description |
request |
ISearchDataObjectsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
Transform |
{Stream} An object stream which emits an object representing SearchResult on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using |