listIndexes( )


Lists all indexes defined for a data collection.

When an index's status is ACTIVE, it is ready to use. While it is still being created, its status is BUILDING.

When an index's status is DROPPED, it has been dropped successfully. While it is still in the process of being removed, its status is DROPPING.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Data Indexes
Manage All Data Resources
Learn more about app permissions.
Method Declaration
Copy
function listIndexes(
  dataCollectionId: string,
  options: ListIndexesOptions,
): Promise<ListIndexesResponse>;
Method Parameters
dataCollectionIdstringRequired

ID of the data collection for which to list indexes.


optionsListIndexesOptions

Options for retrieving a list of indexes.

Returns
Return Type:Promise<ListIndexesResponse>
JavaScript
import { indexes } from "wix-data.v2"; /* * Sample dataCollectionId value = 'Jackets' * * Sample options value = { * limit: 5 * } */ export async function myListIndexesFunction(dataCollectionId, options) { try { const listIndexesResponse = await indexes.listIndexes( dataCollectionId, options, ); console.log( `List of indexes for this collection: ${listIndexesResponse.indexes}`, ); return listIndexesResponse; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to a list of indexes for the specified collection, with paging metadata: * { * "indexes": [ * { * "caseInsensitive": true, * "fields": [ * { * "order": "ASC" * "path": "itemName", * }, * { * "order": "DESC" * "path": "size", * } * ], * "name": "byItemNameAndSize", * "status": "ACTIVE", * "unique": false, * }, * { * "caseInsensitive": false * "fields": [ * { * "order": "ASC" * "path": "size", * }, * { * "order": "DESC" * "path": "available", * } * ], * "name": "bySizeAndAvailability", * "status": "ACTIVE", * "unique": false, * } * ], * "pagingMetadata": { * "count": 2, * "offset": 0, * "total": 2, * "tooManyToCount": false * } * } */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?