header-logo
Learn how to use Wix to build your site and business.
Design and manage your site using intuitive Wix features.
Manage subscriptions, plans and invoices.
Run your business and connect with members.
Learn to purchase, connect or transfer a domain to your site.
Get tools to grow your business and web presence.
Boost your visibility with SEO and marketing tools.
Get advanced features to help you work more efficiently.
Find solutions, learn about known issues or contact us.
placeholder-preview-image
Improve your skills with our courses and tutorials.
Get tips for web design, marketing and more.
Learn to increase organic site traffic from search engines.
Build a custom site using our full-stack platform.
Get matched with a specialist to help you reach your goals.
placeholder-preview-image

CMS: Adding an Index for Your Collection

6 min
In this article
  • Understanding index types
  • Regular indexes
  • Unique indexes
  • Index quotas
  • Creating an index for your collection
  • FAQs
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.

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.
A 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

You can create up to 32 regular and 32 unique indexes to 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. Enter a name to describe what the index will be used for. 
  6. Choose the type of index you want to create: 

FAQs

Click below for answers to common questions about indexing collection data. 
A screenshot of setting up a regular index.
A screenshot of setting up a unique index.