> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/xsoar-6-administrator-guide/6.14/onboard-cortex-xsoar/elasticsearch/elasticsearch-setup/elasticsearch-configurations.md).

# Elasticsearch Configurations

Cortex XSOAR uses the **`demisto.conf`** file to store the Elasticsearch configuration details. When setting up Elasticsearch for a new Cortex XSOAR installation or migrating data from BoltDB to Elasticsearch, you need to add connection information for the Elasticsearch database to the demisto.conf file. You can also add optional parameters including shards, replicas, and refresh intervals for the indices that will be created within Elasticsearch

For more information about Elasticsearch configuration for Cortex XSOAR, we recommend reviewing [Elasticsearch Best Practices](/xsoar-6-administrator-guide/6.14/onboard-cortex-xsoar/elasticsearch/elasticsearch-setup.md#elasticsearch-best-practices) before editing the configuration file.

Edit the **`/etc/demisto.conf`** file to add the new Elasticsearch configuration. At a minimum, you must provide the URL and a username/password or API key. You can also provide an indexPrefix if you want the indices to be created with a different prefix.

**Example**

```programlisting
{
     "elasticsearch": {
           "username": "elastic",
           "password": "changeme",
           "apiKey": "",
           "url": "https://readyelasticone:9200",
           "enabled": true,
           "insecure": true,
           "indexPrefix": "",
           "responseHeaderTimeoutSeconds": 120,
           "shards": {
               "common-invplaybook": 3,
               "common-entry": 3
           },
           "replicas": {
               "common-invplaybook": 1,
               "common-entry": 1
           },
           "defaultShardsPerIndex": 1,
           "defaultReplicasPerIndex": 2,
           "refreshIntervals": {
               "*": "30s",
               "common-configuration": "1s",
               "common-incident": "1s"
           }
       } 
}
```

{% hint style="info" %}

### Note

If you move to Elasticsearch without migrating data or do a migration that is only partially successful, you need to add the **`externalEntities`** key to the Server key. If you successfully migrate your data, the key is added automatically.

```programlisting
"Server": {
             "HttpsPort": "443",
             "externalEntities": "incident,indicator,audit,configuration"  // store all types of data objects in Elasticsearch
       },
```

{% endhint %}

The following table lists all the possible Elasticsearch configurations supported in the **`demisto.conf`** file. Use these elements to tweak Elasticsearch performance.

| Name                                  | Type    | Description                                                                                                                                                                                                                                                                                                                 |
| ------------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`url`**                             | string  | <p>The url, or urls, comma-separated to an Elasticsearch node. The url includes the schema and port.</p><p><strong>Default:</strong> <strong><code><http://localhost:9200></code></strong></p><p><strong>Example:</strong> <strong><code>“url”: "<http://localhost:9200>"</code></strong></p>                               |
| **`enabled`**                         | boolean | <p>Set to true to enable the use of Elasticsearch as the database.</p><p><strong>Default:</strong> <strong><code>false</code></strong></p><p><strong>Example:</strong> <strong><code>“enabled”: true</code></strong></p>                                                                                                    |
| **`indexPrefix`**                     | string  | <p>The index prefix to address when creating, writing, and reading from Cortex XSOAR indices.</p><p><strong>Default:</strong> N/a</p><p><strong>Example:</strong> <strong><code>“indexPrefix”: “xsoar”</code></strong></p>                                                                                                  |
| **`proxy`**                           | boolean | <p>Set to true if Elasticsearch is used behind a proxy service.</p><p><strong>Default:</strong> <strong><code>false</code></strong></p><p><strong>Example:</strong> <strong><code>“proxy”: true</code></strong></p>                                                                                                         |
| **`username`**                        | string  | <p>The Elasticsearch username to establish a connection.</p><p>\* required (unless API key is provided)</p><p><strong>Default:</strong> N/a</p><p><strong>Example:</strong> <strong><code>“username”: “elastic”</code></strong></p>                                                                                         |
| **`password`**                        | string  | <p>A plain or encrypted password for Elasticsearch to establish connection.</p><p>\* required (unless API key is used)</p><p><strong>Default:</strong> N/a</p><p><strong>Example:</strong> <strong><code>“password”: “123”</code></strong></p>                                                                              |
| **`apiKey`**                          | string  | <p>The Elasticsearch API key to establish connection.</p><p>\* required (unless a username and password are used)</p><p><strong>Default:</strong> N/a</p><p><strong>Example:</strong> <strong><code>“apiKey”: “ani1”</code></strong></p>                                                                                    |
| **`insecure`**                        | boolean | <p>Allow an insecure connection to Elasticsearch for unsigned certificates.</p><p><strong>Default:</strong> <strong><code>false</code></strong></p><p><strong>Example:</strong> <strong><code>“insecure”: true</code></strong></p>                                                                                          |
| **`responseHeaderTimeoutSeconds`**    | number  | <p>The number of seconds for timeout while awaiting response headers from Elasticsearch.</p><p><strong>Default:</strong> <strong><code>0</code></strong></p><p><strong>Example:</strong> <strong><code>“responseHeaderTimeoutSeconds”: 60</code></strong></p>                                                               |
| **`dialerTimeoutSeconds`**            | number  | <p>The number of seconds for timeout while awaiting to establish connection to Elasticsearch.</p><p><strong>Default:</strong> <strong><code>30</code></strong></p><p><strong>Example:</strong> <strong><code>“dialerTimeoutSeconds”: 60</code></strong></p>                                                                 |
| **`maxIdleConnections`**              | number  | <p>The maximum number of idle connections to Elasticsearch that remain alive.</p><p><strong>Default:</strong> <strong><code>100</code></strong></p><p><strong>Example:</strong> <strong><code>“maxIdleConnections”: 400</code></strong></p>                                                                                 |
| **`idleConnectionTimeout`**           | number  | <p>The number of seconds for an idle connection to be closed, if not used.</p><p><strong>Default:</strong> <strong><code>100</code></strong></p><p><strong>Example:</strong> <strong><code>“idleConnectionTimeout”: 200</code></strong></p>                                                                                 |
| **`maxRetriesOnConnectivity`**        | number  | <p>The amount of maximum retries when connection is refused or not found from Elasticsearch.</p><p><strong>Default:</strong> <strong><code>10</code></strong></p><p><strong>Example:</strong> <strong><code>“maxRetriesOnConnectivity”: 50</code></strong></p>                                                              |
| **`shards`**                          | object  | <p>An index name for the number of shards for an object to determine shards allocation on each index.</p><p><strong>Default:</strong> N/a</p><p><strong>Example:</strong> <strong><code>“shards”: { “common-incident”: 1 }</code></strong></p>                                                                              |
| **`replicas`**                        | object  | <p>An index name for the number of replica objects to determine the replicas allocation on each index.</p><p><strong>Default:</strong> N/a</p><p><strong>Example:</strong> <strong><code>“replicas”: { “common- incident”: 1 }</code></strong></p>                                                                          |
| **`defaultShardsPerIndex`**           | number  | <p>The default number of shards for each index created using Cortex XSOAR.</p><p><strong>Default:</strong> N/a</p><p><strong>Example:</strong> <strong><code>“defaultShardsPerIndex”: 1</code></strong></p>                                                                                                                 |
| **`defaultReplicasPerIndex`**         | number  | <p>The default number of replicas for each index created using Cortex XSOAR.</p><p><strong>Default:</strong> N/a</p><p><strong>Example:</strong> <strong><code>“defaultReplicasPerIndex”: 2</code></strong></p>                                                                                                             |
| **`totalFields`**                     | object  | <p>An index name for the number of maximum fields allowed in the index mapping.</p><p><strong>Default:</strong> <strong><code>{ “common-incident”: 2000, “common-indicator”: 2000, “common-evidence”: 2000 }</code></strong></p><p><strong>Example:</strong> <strong><code>{ “common- incident”: 5000 }</code></strong></p> |
| **`refreshIntervals`**                | object  | <p>An index name to number of seconds to perform refresh on the index. Use <strong><code>\*</code></strong> for all indices.</p><p><strong>Default:</strong> N/a</p><p><strong>Example:</strong> <strong><code>{ “common-configuration”: 30, “common-incident”: 1 }</code></strong></p>                                     |
| **`innerBatchSize`**                  | number  | <p>The amount of maximum objects to send to Elasticsearch when using bulk updates.</p><p><strong>Default:</strong> <strong><code>250</code></strong></p><p><strong>Example:</strong> <strong><code>“innerBatchSize”: 500</code></strong></p>                                                                                |
| **`maxRetriesOnVersionConflicts`**    | number  | <p>Amount of retries to run on version conflict errors received from Elasticsearch.</p><p><strong>Default:</strong> <strong><code>10</code></strong></p><p><strong>Example:</strong> <strong><code>“maxRetriesOnVersionConflicts”: 30</code></strong></p>                                                                   |
| **`maxResultWindow`**                 | number  | <p>Maximum allowed results to return from Elasticsearch searches.</p><p><strong>Default:</strong> <strong><code>10000</code></strong></p><p><strong>Example:</strong> “maxResultWindow”: 50000</p>                                                                                                                          |
| **`aggregationMaxSize`**              | number  | <p>Maximum allowed results to return from Elasticsearch aggregations.</p><p><strong>Default:</strong> <strong><code>1000</code></strong></p><p><strong>Example:</strong> <strong><code>“aggregationMaxSize”: 5000</code></strong></p>                                                                                       |
| **`lastFeedFetchLimit`**              | number  | <p>Maximum allowed objects to store on the last feed fetch limit.</p><p><strong>Default:</strong> <strong><code>300000</code></strong></p><p><strong>Example:</strong> <strong><code>“lastFeedFetchLimit”: 100000</code></strong></p>                                                                                       |
| **`disableCreateIncidentForceIndex`** | boolean | <p>Disable force refresh on new incidents to allow back-to-back searches using pre-processing scripts.</p><p><strong>Default:</strong> <strong><code>false</code></strong></p><p><strong>Example:</strong> <strong><code>“disableCreateIncidentForceIndex”: true</code></strong></p>                                        |
| **`template.patternPrefix`**          | string  | <p>Use a custom template name prefix.</p><p><strong>Default:</strong> <strong><code>indexPrefix</code></strong></p><p><strong>Example:</strong> <strong><code>“template.patternPrefix”: “template-name”</code></strong></p>                                                                                                 |
| **`role.roles`**                      | array   | <p>Default cluster roles to provide new users in Elasticsearch created in Cortex XSOAR.</p><p><strong>Default:</strong> <strong><code>\[“manage”, “monitor”, “manage\_own\_api\_key”]</code></strong></p><p><strong>Example:</strong> <strong><code>“role.roles”: \[“manage”]</code></strong></p>                           |
| **`api.roles`**                       | array   | <p>Default cluster roles to provide new API keys in Elasticsearch created in Cortex XSOAR.</p><p><strong>Default:</strong> <strong><code>\[“manage”, “monitor”, “manage\_own\_api\_key”]</code></strong></p><p><strong>Example:</strong> <strong><code>“api.roles”: \[“manage”]</code></strong></p>                         |
| **`debug.enableQuery`**               | boolean | <p>Show Elasticsearch built queries before sending when using the log level debug.</p><p><strong>Default:</strong> <strong><code>false</code></strong></p><p><strong>Example:</strong> <strong><code>“debug.enableQuery”: true</code></strong></p>                                                                          |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cortex-docs.paloaltonetworks.com/xsoar-6-administrator-guide/6.14/onboard-cortex-xsoar/elasticsearch/elasticsearch-setup/elasticsearch-configurations.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
