> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # ListIndexes # Package: collectionManagement # Namespace: IndexService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/indexes/list-indexes.md ## Permission Scopes: Manage Data Indexes: SCOPE.DC-DATA.INDEXES-MANAGE ## Introduction 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`. --- ## REST API ### Schema ``` Method: listIndexes Description: 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`. URL: https://www.wixapis.com/wix-data/v2/indexes Method: GET # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: dataCollectionId Method parameters: query param name: dataCollectionId | type: dataCollectionId | description: GUID of the data collection for which to list indexes. | required: true param name: paging | type: Paging - name: limit | type: integer | description: Number of items to load. - name: offset | type: integer | description: Number of items to skip in the current sort order. Return type: ListIndexesResponse - name: indexes | type: array | description: List of all indexes for the requested data collection. - name: id | type: string | description: GUID of the index. - name: name | type: string | description: Name of the index. - name: fields | type: array | description: Fields for which the index is defined. Max: 3 fields (for a unique index: 1 field) - name: path | type: string | description: Path of the field to index. For example: `title` or `options.price`. - name: order | type: Order | description: Sort order for the index. Base on how the data is regularly queried. Default: `ASC` - enum: ASC, DESC - name: status | type: Status | description: Current status of the index. - enum: - UNKNOWN: Place holder. Never returned by the service. - BUILDING: Index creation is in progress. - ACTIVE: Index has been successfully created and can be used in queries. - DROPPING: Index is in the process of being dropped. - DROPPED: Index has been dropped successfully. - FAILED: Index creation has failed. - INVALID: Index contains incorrectly indexed data. - name: failure | type: Failure | description: Contains details about the reasons for failure when `status` is `FAILED`. - name: code | type: string | description: Error code. - `WDE0112`: Unknown error while building collection index. - `WDE0113`: Duplicate key error while building collection index. - `WDE0114`: Document too large while building collection index. - name: description | type: string | description: Description of the failure. - name: itemId | type: string | description: GUID of the data item that caused the failure. For example, if `unique` is `true`, the GUID of an item containing a duplicate value. - name: unique | type: boolean | description: Whether the index enforces uniqueness of values in the field for which it's defined. If `true`, the index can have only 1 field. Default: `false` - name: caseInsensitive | type: boolean | description: Whether the index ignores case. Default: `false` - name: source | type: IndexSource | description: Source of the index. See index sources in [Index Types](https://dev.wix.com/docs/api-reference/business-solutions/cms/indexes/index-types.md#index-sources). Default: `USER` - enum: - SYSTEM: Automatically created by Wix for all collections. System indexes are created for essential attributes, such as ID and creation date. You can't delete them and they don't count towards the index limit. - USER: Created by a Wix user via the API or in the dashboard. - AUTO: Created automatically by Wix based on a Wix user's queries. For large collections, Wix identifies slow-running queries and creates indexes automatically to improve performance. These indexes don't count towards the index limit. They're created dynamically, and may be deleted if they no longer fit the system's parameters. To keep an automatic index permanently, manually create an identical `USER` index. - name: pagingMetadata | type: PagingMetadata | description: Paging metadata. - name: count | type: integer | description: Number of items returned in the response. - name: offset | type: integer | description: Offset that was requested. - name: total | type: integer | description: Total number of items that match the query. - name: tooManyToCount | type: boolean | description: Flag that indicates the server failed to calculate the `total` field. ``` ### Examples ### List indexes (example with a failed index) ```curl curl -X GET \ 'https://www.wixapis.com/wix-data/v2/indexes?collectionName=my-collection' \ -H 'Content-Type: application/json' \ -H 'Authorization: ' ``` ### List all indexes defined for a collection ```curl curl -X GET \ 'https://www.wixapis.com/wix-data/v2/indexes?dataCollectionId=my-collection' \ -H 'Content-Type: application/json' \ -H 'Authorization: ' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.collectionManagement.IndexService.listIndexes(dataCollectionId, options) Description: 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`. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: dataCollectionId Method parameters: param name: dataCollectionId | type: string | description: GUID of the data collection for which to list indexes. | required: true param name: options | type: ListIndexesOptions none - name: paging | type: Paging | description: Paging options to limit and skip the number of items. - name: limit | type: integer | description: Number of items to load. - name: offset | type: integer | description: Number of items to skip in the current sort order. Return type: PROMISE - name: indexes | type: array | description: List of all indexes for the requested data collection. - name: _id | type: string | description: GUID of the index. - name: name | type: string | description: Name of the index. - name: fields | type: array | description: Fields for which the index is defined. Max: 3 fields (for a unique index: 1 field) - name: path | type: string | description: Path of the field to index. For example: `title` or `options.price`. - name: order | type: Order | description: Sort order for the index. Base on how the data is regularly queried. Default: `ASC` - enum: ASC, DESC - name: status | type: Status | description: Current status of the index. - enum: - UNKNOWN: Place holder. Never returned by the service. - BUILDING: Index creation is in progress. - ACTIVE: Index has been successfully created and can be used in queries. - DROPPING: Index is in the process of being dropped. - DROPPED: Index has been dropped successfully. - FAILED: Index creation has failed. - INVALID: Index contains incorrectly indexed data. - name: failure | type: Failure | description: Contains details about the reasons for failure when `status` is `FAILED`. - name: code | type: string | description: Error code. - `WDE0112`: Unknown error while building collection index. - `WDE0113`: Duplicate key error while building collection index. - `WDE0114`: Document too large while building collection index. - name: description | type: string | description: Description of the failure. - name: itemId | type: string | description: GUID of the data item that caused the failure. For example, if `unique` is `true`, the GUID of an item containing a duplicate value. - name: unique | type: boolean | description: Whether the index enforces uniqueness of values in the field for which it's defined. If `true`, the index can have only 1 field. Default: `false` - name: caseInsensitive | type: boolean | description: Whether the index ignores case. Default: `false` - name: source | type: IndexSource | description: Source of the index. See index sources in [Index Types](https://dev.wix.com/docs/api-reference/business-solutions/cms/indexes/index-types.md#index-sources). Default: `USER` - enum: - SYSTEM: Automatically created by Wix for all collections. System indexes are created for essential attributes, such as ID and creation date. You can't delete them and they don't count towards the index limit. - USER: Created by a Wix user via the API or in the dashboard. - AUTO: Created automatically by Wix based on a Wix user's queries. For large collections, Wix identifies slow-running queries and creates indexes automatically to improve performance. These indexes don't count towards the index limit. They're created dynamically, and may be deleted if they no longer fit the system's parameters. To keep an automatic index permanently, manually create an identical `USER` index. - name: pagingMetadata | type: PagingMetadata | description: Paging metadata. - name: count | type: integer | description: Number of items returned in the response. - name: offset | type: integer | description: Offset that was requested. - name: total | type: integer | description: Total number of items that match the query. - name: tooManyToCount | type: boolean | description: Flag that indicates the server failed to calculate the `total` field. ``` ### Examples ### listIndexes ```javascript import { indexes } from '@wix/data'; async function listIndexes(dataCollectionId,options) { const response = await indexes.listIndexes(dataCollectionId,options); }; ``` ### listIndexes (with elevated permissions) ```javascript import { indexes } from '@wix/data'; import { auth } from '@wix/essentials'; async function myListIndexesMethod(dataCollectionId,options) { const elevatedListIndexes = auth.elevate(indexes.listIndexes); const response = await elevatedListIndexes(dataCollectionId,options); } ``` ### listIndexes (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { indexes } from '@wix/data'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { indexes }, // Include the auth strategy and host as relevant }); async function listIndexes(dataCollectionId,options) { const response = await myWixClient.indexes.listIndexes(dataCollectionId,options); }; ``` ---