Guides / Sending and managing data

Manage Your Application Environment

One or multiple applications

When you run your application in different environments, you usually want to use different datasets. For instance, when running your application locally or on a staging website, you often use fake data instead of real, production datasets.

Same goes for search. When working on a local or staging version of your website, you may want to avoid hitting your production index for privacy reasons, to avoid skewing your analytics, and to avoid consuming units.

There are two ways to split your search implementation for each environment:

  1. Separate your environments into different indices on the same app
  2. Create several apps, and use one per environment

The best approach depends on the level of isolation you need between your environments.

All environments on the same application

With this option, you create different indices for each environment. You can prefix each index’s name with the name of its environment: dev_products, staging_products, prod_products, etc., making it easier to target them later on.

Since these indices are on the same application, they share the same application ID. However, you can create an Algolia user for each environment with different search and admin API keys to control their access level.

Your plan must include the Advanced Team Permissions add-on to create a dedicated user per environment. Please check the pricing page for more details.

You can create a new team member with access to all indices of a single environment. In the Algolia dashboard, go to the Team page. Then, click the Add Team Member button, and add your prefix in the indices box followed by a "*" (asterisk) character. For example, use staging_* for your staging environment.

Create an Algolia user with limited index access

You can find the admin and search-only API keys for this user in the API Keys page of the Algolia dashboard. These keys only give them access to indices matching "staging_*". You can use those keys in your code to ensure isolation between environments.

You can repeat the same operation for all your environments. The only shared elements between your environments are the number of records and operations since they belong to the same application.

One application per environment

This approach provides complete isolation between your environments. From Algolia’s point of view, these are different apps (each with its own plan) that you can both manage from the Algolia dashboard.

You can create a new application on the Applications page of the Algolia dashboard, or by clicking the applications dropdown menu in the sidebar, then clicking Add new application.

Unless your plan includes a dedicated cluster of servers, having multiple applications generates an invoice per application. For example, if you have two applications and both use more units than the free tier provides, Algolia charges you for both plans.

Did you find this page helpful?