Manage indexes
An index is a basic unit for organizing and storing video data consisting of video embeddings and metadata. Indexes facilitate information retrieval and processing. The Resources.Index
class provides methods to manage your indexes.
Properties
Methods
Create an index
Description: This method creates a new index based on the provided parameters.
Function signature and example:
Parameters
The CreateIndexParams
interface has the following properties:
Return value: Returns a Promise
that resolves to a Models.Index
instance representing the newly created index.
API Reference: For a description of each field in the request and response, see the Create an index page.
Related guide: Create indexes.
Retrieve an index
Description: This method retrieves details of a specific index.
Function signature and example:
Parameters
Return value: Returns a Promise
that resolves to a Models.Index
instance.
API Reference: For a description of each field in the request and response, see the Retrieve an index page
List indexes with direct pagination
Description: The list method retrieves a paginated list of indexes based on the provided parameters. Choose this method mainly when the total number of items is manageable, or you must fetch a single page of results. By default, the platform returns your indexes sorted by creation date, with the newest at the top of the list.
Function signature and example:
Parameters
The ListIndexParams
interface extends the PageOptions
interface and defines the parameters for listing indexes:
The following properties are inherited from PageOptions
:
Return value: Returns a Promise
that resolves to an array of Models.Index
instances.
API Reference: For a description of each field in the request and response, see the List indexes page.
Related guides:
List indexes with iterative pagination
Description: This method iterates through a paginated list of indexes based on the provided parameters. Choose this method mainly when your application must retrieve a large number of items. By default, the platform returns your indexes sorted by creation date, with the newest at the top of the list.
Function signature and example:
Parameters
The ListIndexParams
interface extends the PageOptions
interface and defines the parameters for listing indexes:
The following properties are inherited from PageOptions
:
Return value: Returns a Promise
that resolves to a Models.IndexListWithPagination
instance.
Note
To retrieve subsequent pages of results, use the async iterator protocol:
- Invoke the
next
method of theIndexListWithPagination
object. - Repeat this call until the method returns a promise that resolves to
null
, indicating no more pages exist.
API Reference: For a description of each field in the request and response, see the List indexes page.
Related guides:
Update an index
Description: This method updates the name of an existing index.
Function signature and example:
Parameters:
Return value: Returns a Promise
that resolves to void
. This method doesn’t return any data upon successful completion.
API Reference: Update an index.
Delete an index
Description: This method deletes an existing index.
Function signature and example:
Parameters:
Return value: Returns a Promise
that resolves to void
. This method doesn’t return any data upon successful completion.
API Reference: Delete an index.