# Elasticsearch

## Overview

The source code and default configuration of the Building Block is available in our [code.syseleven.de](<https://code.syseleven.de/syseleven/building-blocks/helmfiles/elasticsearch>). Infos on release notes and new features please follow [Release notes Elasticsearch](<https://code.syseleven.de/syseleven/building-blocks/helmfiles/elasticsearch/-/blob/main/RELEASE-NOTES.md>)

### Elastic-Search

With Elastic-Search we provide a search engine which persists documents into its NoSQL database. You can integrate this building block to provide search engine capabilities to your application.

This building block will deploy a three node Elasticsearch cluster using the OSS variant. These three nodes are eligible to act as master and serve as data and ingest node.

### Prerequisites On Elasticsearch

Proceed with the following prerequisite description to use the Building Block out of the box.

#### Recommended Setup

A recommended resource overview is listed in the table below.

| CPU / vCPU | Memory |
| --- | --- |
| 1.0 | 6GiB |

No further activities need to be carried out in advance.

### Adding The Building Block

Add the directory `syseleven-elasticsearch` to your control repository. Add a `.gitlab-ci.yml` to the directory with the following content:

```yaml
include:
  - project: syseleven/building-blocks/helmfiles/elasticsearch
    file: JobDevelopment.yaml
    ref: {{ site.building_blocks.elasticsearch.version|e }}
  - project: syseleven/building-blocks/helmfiles/elasticsearch
    file: JobStaging.yaml
    ref: {{ site.building_blocks.elasticsearch.version|e }}
  - project: syseleven/building-blocks/helmfiles/elasticsearch
    file: JobProduction.yaml
    ref: {{ site.building_blocks.elasticsearch.version|e }}
```

Remove environments you are not using by removing their include.

### Required Configuration

No configuration is required.

### Configuration

#### Select Elasticsearch Version

To select a different Elasticsearch version the following parameters have to be adjusted to the corresponding major version and to the specific release.

```yaml
esMajorVersion: "6"
imageTag: '6.8.14'
```

> [!NOTE]
>
> The building block only supports Elasticsearch OSS up to latest 7.10 release.

#### Elasticsearch heapsize/pod limits config option

For a production-grade setup, it is highly recommended to define a JVM heapsize for Elasticsearch which is half of the configured memory limit of the pod.

```yaml
esJavaOpts: "-Xmx2g -Xms2g"

resources:
  requests:
    memory: "4Gi"
  limits:
    memory: "4Gi"
```

### Scaling Setup

You can scale your Elastic-Search Building Block with the usual scaling techniques like increasing replicas and so on.

### Release-Notes

Please find more infos on release notes and new features [release notes Elastic Search](<https://code.syseleven.de/syseleven/building-blocks/helmfiles/elasticsearch/-/blob/main/RELEASE-NOTES.md>)
