> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Introduction

## Article: Introduction

## Article Link: https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/indexes/introduction.md

## Article Content:

# About the Indexes API

> **Note for app developers:** Wix Data APIs require the site's [code editor](https://dev.wix.com/docs/develop-websites/articles/get-started/development-environments.md) to be enabled. If you are building a Wix app, add a [data collections extension](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/data-collections/about-data-collections-extensions.md) to automatically enable the code editor and create data collections when your app is installed on a site.


The Indexes API enables you to create indexes for data collections, to make querying data faster.

An index is a map of a collection's data, organized according to fields that you select. An index [increases the speed of queries](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/indexes/indexes-and-query-speed.md) by providing a query with a shortcut to the information it's looking for. Instead of iterating through every data item in the collection, a query can use the index to skip to potentially relevant items. The larger a collection is, the more time this saves.

With the Indexes API, you can:
- Create regular indexes to accelerate query speed.
- Create unique indexes to enforce unique values.
- Access and drop existing indexes.

To learn about the differences between regular and unique indexes, see [Index Types](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/indexes/index-types.md).

## Before you begin

It's important to note the following points before starting to code:

- A collection can have up to 3 regular indexes (for up to 3 fields per index). It may also have 1 unique index (for 1 field).
- Some indexes are [generated by Wix automatically](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/indexes/index-types.md). These indexes don't count towards the index limit.
- The value contained in an indexed field can't be larger than 982 bytes, including the collection name. For example, in a collection named "Products", the maximum length of each value in the indexed fields is 974 bytes.
- When an index creation fails, the failed index still occupies a slot. To remove the failed index and free up the slot for a new index, call [Drop Index](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/indexes/drop-index.md).
- Case-insensitive filters, such as `$startsWith`, aren't accelerated by an index.

## Use case
+ [Optimize query performance for a collection with multiple indexes](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/indexes/sample-flows.md)

## Terminology

- **Regular index:** An index that increases query speed. Up to 3 fields can be selected for a regular index.
- **Unique index:** An index that increases query speed and enforces unique values for 1 field.

## SDK Setup
  `@wix/data`

To use the API, install the `@wix/data` package.

#### Install the package

Follow the installation instructions for your development environment.

| Development environment | Installation method |
|--|--|
| Wix sites (editor or IDE) | Use the [package manager](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/packages/work-with-npm-packages-in-the-editor.md). |
| Wix sites (local IDE) | Run `wix install @wix/data` using the [Wix CLI](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/packages/work-with-npm-packages-with-the-wix-cli.md).|
| Blocks apps | Use the same installation method as Wix sites. |
| CLI and self-hosted apps | Run `npm install @wix/data` or `yarn add @wix/data`. |
| Headless sites and apps | Run `npm install @wix/data` or `yarn add @wix/data`. |

#### Import the package

To import the package in your code:

```js
import { indexes } from '@wix/data'
```

#### Import types

Types for this API are accessed through the `indexes` namespace you already imported above, as `indexes.<TypeName>`, using any type name shown in these docs.
  