> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/adapters/e/elasticsearch.md).

# Elasticsearch

Elasticsearch is a search and analytics engine. OctoXLabs reads every document of one index and imports each document as a device. Use it to bring in inventory data that you already keep in an index.

## Use cases

* Import devices that a custom tool writes into an index.

```
Adapters = elasticsearch
```

* Find indexed devices that your EDR does not see.

```
Adapters = elasticsearch AND NOT Adapters = falcon-crowdstrike
```

## Before you begin

### Network

| Source              | Destination                             | Port                   | Protocol                          |
| ------------------- | --------------------------------------- | ---------------------- | --------------------------------- |
| OctoXLabs connector | Elasticsearch host (as written in Host) | Port from the Host URL | HTTP or HTTPS, as in the Host URL |

### Required permissions

| Scope or role      | Permission                            | Needed for      |
| ------------------ | ------------------------------------- | --------------- |
| Elasticsearch user | Read (search and scroll) on the index | Index documents |

Not verified: exact cluster and index privileges. The connector checks that the index exists, pings the cluster, and runs search and scroll on the index.

## Create credentials in Elasticsearch

{% stepper %}
{% step %}

### Choose the index

Decide which index holds the device documents.
{% endstep %}

{% step %}

### Prepare a user

If the cluster needs authentication, create a user that can read that index. Authentication is sent only when the Host starts with `https`.
{% endstep %}
{% endstepper %}

## Connection parameters

| Parameter              | Required | Type              | Default | Description                                                                        |
| ---------------------- | -------- | ----------------- | ------- | ---------------------------------------------------------------------------------- |
| Host                   | Yes      | String            | None    | Elasticsearch address, including scheme and port, for example `https://host:9200`. |
| Index                  | Yes      | String            | None    | Index to fetch.                                                                    |
| Username               | No       | String            | None    | User name. Code uses `elastic` if the field is absent.                             |
| Password               | No       | String            | None    | Password.                                                                          |
| Proxy URL              | No       | String            | None    | Proxy URL.                                                                         |
| Proxy Username         | No       | String            | None    | Proxy user name.                                                                   |
| Proxy Password         | No       | String            | None    | Proxy password.                                                                    |
| Verify SSL Certificate | No       | Boolean           | `False` | Verify the server certificate.                                                     |
| Timeout                | No       | Integer (seconds) | `60`    | Time to wait for a response.                                                       |
| Max Retries            | No       | Integer           | `10`    | Maximum retries when the host does not respond.                                    |
| Retry On Timeout       | No       | Boolean           | `True`  | Retry when the host times out.                                                     |

## Troubleshooting

| Error message                              | Cause                              | Fix                                      |
| ------------------------------------------ | ---------------------------------- | ---------------------------------------- |
| `Index not found: <index>`                 | The index does not exist.          | Check the Index name.                    |
| `Elasticsearch connection failed`          | The cluster did not answer a ping. | Check the Host, credentials and network. |
| `Elasticsearch connection failed: <error>` | The test search failed.            | Check read permission on the index.      |

## Change history

{% hint style="info" %}
Available starting from version 5.3.0.
{% endhint %}
