top of page

Managing CMS collections

CMS: Adding an Index for Your Collection

Set up indexes in your Wix CMS to optimize data retrieval times. You can choose between creating regular or unique indexes based on your specific needs.

Think of your collection as a database full of information which represents your content. To display this content on a page, the CMS (Content Management System) performs database searches. As your content grows, these searches can take longer, affecting the speed at which information is retrieved.

User input elements also influence database searches. For example, a dropdown input element may display a list of options from your collection. When site visitors click this dropdown, they are effectively searching your collection.

Indexes serve as shortcuts that map the structure of your data, allowing the CMS to retrieve information more efficiently. By creating an index, you help the system avoid scanning the entire database each time a search is performed. This significantly speeds up data retrieval, especially when your collection contains many items, ultimately enhancing the user experience on your site.

Screenshot of a unique and regular index created for a CMS collection.

Understanding index types

Choosing the right index type for your CMS collection is key to meeting your data needs. There are two main types: regular indexes and unique indexes.

Regular indexes

regular index is designed to enhance data retrieval speed by allowing you to search across multiple fields within your collection. Use this type if you need to optimize performance for queries involving multiple fields. Regular indexes can include up to three fields, making them ideal for queries that filter or sort based on various attributes.

Tips:

  • When creating a regular index, choose fields that match the most frequent queries on your site. For example, if you have a real estate site and you use a repeater to show the most popular houses for sale on your homepage, you could create an index that includes the fields: 'City', 'Property type', and 'Most popular'. If your queries use different filters for different searches, it’s best to create separate indexes for each filter set.

  • For the best performance, ensure the sort order of your dataset or queries matches the order defined in your index.

Screenshot of setting up a regular index.

Unique indexes

A unique index enforces data integrity by ensuring that values in a specific field are distinct across all collection items. This type of index is limited to one field and is ideal for scenarios where each entry must be unique, such as user IDs, email addresses, or product SKUs. It automatically prevents duplicates by rejecting attempts to add or update items with identical values.

For example, if you create a unique index for email addresses, it will prevent duplicate entries, ensuring that each email address in your collection remains unique. This is especially crucial for user accounts or any dataset where duplicates could cause confusion or errors.

A screenshot of setting up a unique index.

Index quotas

The number of indexes you can create depends on your site plan:

  • Free and upgraded sites: Up to 4 user-created indexes per collection (1 unique index + 3 regular indexes).

  • Sites with the Business Elite or Elite plans: Up to 15 user-created indexes per collection:2 unique indexes.
    13 regular indexes (up to 5 three-field indexes and 8 single-field indexes).

You can upgrade your site if you need additional indexes.

Note:

System indexes (like the ID or creation date fields) do not count toward this quota.

Creating an index for your collection

Go to your collection in the CMS to create regular or unique indexes that optimize how your collection retrieves and organizes data.

To create an index:

  1. Go to CMS in your site's dashboard.

  2. Click the relevant collection.

  3. Click the More Actions drop-down at the top right and select Indexes.

  4. Click + Add Index.

  5. Choose the type of index you want to create: Regular or Unique

Regular

Create an index for up to 3 different fields that allows duplicate values.

  1. Select Regular under Select Index Type.

  2. Enter a name for the index in the Index Name field.

  3. Add the field that you want the search query to speed up:Click the Choose a field drop-down and choose a field you want to index.
    Click the Sort drop-down and choose the order in which the field will be sorted in the index.
    Tip: For best performance with single-field indexes, we recommend using only the Ascending sort order (A-Z for text fields, low-high for number fields).

  4. (Optional) Repeat step 2 to add up to 3 fields.
    Tip: For multi-field indexes, we recommend matching the sort order of each field to the sort order in the search query you want to optimize.

  5. Click Save.

Unique

Create an index to ensure all values of a specific field are distinct.

  1. Select Unique under Select Index Type.

  2. Enter a name for the index in the Index Name field.

  3. Add the field that you want the search query to speed up:Click the Choose a Field drop-down and choose the field you want to index.
    Click the Sort drop-down and choose the order in which the field will be sorted in the index.
    Tip: For best performance, we recommend using only the Ascending sort order (A-Z for text fields, low-high for number fields).

  4. Click Save.

FAQs

Click below for answers to common questions about indexing collection data.

Where can I find more advanced documentation about using indexes with coding?

Learn more about indexes and your CMS collections at dev.wix.com.

How many indexes can I create?

Free and upgraded sites can have up to 4 user-created indexes per collection (1 unique index + 3 regular indexes).

Sites with the Business Elite or Elite plans can have up to 15 indexes (2 unique indexes + 13 regular indexes with up to 5 three-field indexes and 8 single-field indexes).

System indexes do not count toward these limits.

Upgrade your site if you need additional indexes for your site's collections.

What are system indexes?

System fields are automatically created by Wix for every collection to improve performance. They include the essential attributes of ID and Creation date and cannot be deleted. Only user-created indexes count towards your maximum allowed index limit, so you can create custom indexes without worrying about system-generated ones affecting your quota.

When should I add an index to my collection?

Consider adding an index if:

  • Your data collection is large and query times are slow.

  • You have frequent database reads that require filtering and sorting.

  • Your query speeds are fine now, but your collection is expected to grow significantly.

Are there times when I shouldn't add an index?

You should consider avoiding adding an index in the following cases:

  • If your collection is frequently added to but not displayed anywhere on your site.

  • If your collection isn’t expected to grow significantly.

  • If your collection already has an index.

Which fields are unsuitable for indexes?

Indexes are most effective for fields with a wide range of values. Fields with a limited range of values, such as booleans, are not ideal for indexing.

For example, if product color is a common search filter and your store offers various colors, adding an index on this field can make queries faster. However, if your store only offers black or white products, the index won't significantly improve query speeds.

Can I remove or edit indexes I create?

Once you save an index, you cannot edit it. However, you can delete the index and add a new one with the needed specifications. You may need to delete an index if you've reached your quota or attempted to create a unique index for a field that contains duplicates.

To delete an index:

  1. Go to CMS in your site's dashboard.

  2. Click the relevant collection.

  3. Click the More Actions drop-down at the top right and select Indexes.

  4. Click Delete next to the index you want to remove.

Note: You cannot delete system indexes, which are automatically created for every collection to improve performance.

What happens if I try to add a duplicate value to a unique index?

If you attempt to add a duplicate value to a unique index, the database will reject the new or updated item.

lord of the wix_edited.jpg

Need A Professional Website?

Contact Us Today!

lord_of_the_wix

© 2025 BY LORD OF THE WIX

©
bottom of page