Class Index (9.1.0)

Package

@google-cloud/datastore

Example

const{Datastore}=require('@google-cloud/datastore');constdatastore=newDatastore();constindex=datastore.index('my-index');

Constructors

(constructor)(datastore, id)

constructor(datastore:Datastore,id:string);

Constructs a new instance of theIndex class

Parameters
NameDescription
datastoreDatastore
idstring

Properties

datastore

datastore:Datastore;

id

id:string;

metadata

metadata?:IIndex;

Methods

get(gaxOptions)

get(gaxOptions?:CallOptions):Promise<GetIndexResponse>;

Get an index if it exists.

Parameter
NameDescription
gaxOptionsCallOptions

Request configuration options, outlined here:https://googleapis.github.io/gax-nodejs/CallSettings.html.

Returns
TypeDescription
Promise<GetIndexResponse>

get(callback)

get(callback:GetIndexCallback):void;
Parameter
NameDescription
callbackGetIndexCallback
Returns
TypeDescription
void

get(gaxOptions, callback)

get(gaxOptions:CallOptions,callback:GetIndexCallback):void;
Parameters
NameDescription
gaxOptionsCallOptions
callbackGetIndexCallback
Returns
TypeDescription
void

getMetadata(gaxOptions)

getMetadata(gaxOptions?:CallOptions):Promise<IndexGetMetadataResponse>;

Get the metadata of this index.

Parameter
NameDescription
gaxOptionsCallOptions

Request configuration options, outlined here:https://googleapis.github.io/gax-nodejs/CallSettings.html.

Returns
TypeDescription
Promise<IndexGetMetadataResponse>

getMetadata(callback)

getMetadata(callback:IndexGetMetadataCallback):void;
Parameter
NameDescription
callbackIndexGetMetadataCallback
Returns
TypeDescription
void

getMetadata(gaxOptions, callback)

getMetadata(gaxOptions:CallOptions,callback:IndexGetMetadataCallback):void;
Parameters
NameDescription
gaxOptionsCallOptions
callbackIndexGetMetadataCallback
Returns
TypeDescription
void

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-10-30 UTC.