---
title: "Adapt your search settings to Solr availability"
slug: "adapt-your-search-settings-to-solr-availability"
abstract: "Use the IsSolrAliveAgent and IndexingStateSwitcher functions to monitor Apache Solr health, availability, and readiness; configure content search and search indexing."
---
# Adapt your search settings to Solr availability

Sitecore includes mechanisms for monitoring the availability of Solr search, and responding to any Solr downtime in a resilient way. You can use these mechanisms, and a Solr endpoint, to adapt your implementation to the availability of Solr search. If you're using Solr 8 or later, Sitecore can use `IsSolrAliveAgent` to periodically check the availability and health of the Solr service, and `IndexingStateSwitcher` to manage Solr content search indexing and search behavior. The agents automatically restore Sitecore search and indexing functionality when the Solr server becomes available, meaning Sitecore administrators don't have to do anything. `IsSolrAliveAgent` and `IndexingStateSwitcher` are both enabled by default. This article explains their usage and how to change their default timeout values if needed.

Additionally, you can use the `/solr/healthz/ready` endpoint provided by Solr to monitor the health and readiness of the Solr server, and to restart the Solr service if needed. You can also [check if the Solr search service is available](https://doc.sitecore.com/xp/en/developers/105/sitecore-experience-manager/find-out-if-the-solr-search-service-is-available.html "Find out if the Solr search service is available") whenever you run a query.

> [!note]
> Solr search is only for internal use in 's UI, and should not be modified. For creating search features, use search tools such as [Sitecore Search](https://doc.sitecore.com/search/en/developers/search-developer-guide/getting-started-with-sitecore-search.html). For more information on integrating Sitecore Search in your environment, see [Integrating Sitecore Search](https://developers.sitecore.com/learn/accelerate/xm-cloud/implementation/sitecore-search/integrating-sitecore-search).

## IsSolrAliveAgent

`IsSolrAliveAgent` checks if the Solr service is running and responsive. The agent makes HTTP requests to Solr endpoints such as `/solr/{core_name}/admin/healthcheck` or `/solr/admin/info/system`. If Solr doesn't send a timely response, or if it returns an error message, it's considered either *Unreachable* or *Not responding*. The agent then logs a warning message in the Sitecore log. It's important to differentiate between the two states:

- Unreachable - an issue is preventing communication with the Solr server, such as network problems or firewall restrictions.
- Not responding - the server received the request but failed to provide a timely or successful response, possibly due to server overload or configuration errors.

If the Solr server is unreachable, it returns an error message to Sitecore. However, if it doesn't respond at all during a defined timeout duration, it is considered unresponsive (*Not responding*). You can adjust the timeout value to differentiate between these scenarios, as described [later in this topic](https://doc.sitecore.com/xp/en/developers/105/sitecore-experience-manager/adapt-your-search-settings-to-solr-availability.html#UUID-b58fda82-7dfd-1298-65b3-9d00f23b3c93_section-idm4583815962078434301889951448 "Configure the timeout value of an agent").

## IndexingStateSwitcher

`IndexingStateSwitcher` controls indexing and search behavior based on the availability of the Solr service. It ensures that indexing operations are synchronized with Solr availability to maintain data integrity. When Solr is detected as unavailable, this agent can pause indexing operations to prevent potential data inconsistencies or errors. It also helps prevent overloading Solr with indexing requests during downtime. When Solr becomes available again, the `IndexingStateSwitcher` agent automatically resumes indexing operations.

You can configure the timeout value for `IndexingStateSwitcher`, as described in the following section.

## Configure the timeout value of an agent

The timeout values for `IsSolrAliveAgent` and `IndexingStateSwitcher` are both defined in seconds, using the `interval` attribute. You change the timeout setting by patching the configuration in the `App_Config\Include` folder. You can also [specify the Solr connection timeout](https://doc.sitecore.com/xp/en/developers/104/platform-administration-and-architecture/specify-connection-timeout.html).

To configure the timeout value of the `IsSolrAliveAgent` or the `IndexingStateSwitcher` agent using a patch file:

> [!note]
> **XM Cloud is now SitecoreAI**
> Some code examples, images, and UI labels may still use XM Cloud while engineering assets are being updated.

1. Create a `.config` file in the `App_Config\Include` folder, for example, `Sitecore.ContentSearch.Solr.config`.

    ![Folder structure and path to the App Config folder for adding a configuration file to change timeout values](https://doc.sitecore.com/api/markdown-image/xp/en/developers/105/sitecore-experience-manager/images/configuration_file_in_app_config_include.png)

2. In the config file, enter the following code structure, and change the `interval` for the agent as needed. In the following example, the intervals are set to 15 and 3 seconds, respectively.

    ```xml
    <?xml version="1.0" encoding="utf-8" ?>
    <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:search="http://www.sitecore.net/xmlconfig/search/">
      <sitecore role:require="Standalone or ContentManagement or ContentDelivery or XMCloud" search:require="solr">
        <scheduling>
          <agent type="Sitecore.ContentSearch.SolrProvider.Agents.IsSolrAliveAgent, Sitecore.ContentSearch.SolrProvider" method="Run" interval="`00:15`:00" />
          <agent type="Sitecore.ContentSearch.SolrProvider.Agents.IndexingStateSwitcher, Sitecore.ContentSearch.SolrProvider" method="Run" interval="`00:03`:00" />
        </scheduling>
      </sitecore>
    </configuration>
    ```

3. Restart the Sitecore application.
4. After you save your file, you can check to see the change reflected in `https://{sitecore_instance_name}/sitecore/admin/showconfig.aspx`, replacing `{sitecore_instance_name}` with your instance.

    ![Code sample that shows how to configure the timeout value for Sitecore Solr agents](https://doc.sitecore.com/api/markdown-image/xp/en/developers/105/sitecore-experience-manager/images/check_changes_in_solr_timeout_config.png)