# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: elasticsearch-log
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: vitam-env-audit-vm-0.priv

# https://www.elastic.co/guide/en/elasticsearch/reference/8.13/modules-node.html#node-roles
# node.roles: [master, data, data_content, data_hot, data_warm, data_cold, data_frozen, ingest, ml, remote_cluster_client, transform]
node.roles: ['master', 'data']

# https://www.elastic.co/guide/en/elasticsearch/reference/8.13/ml-settings.html
xpack.ml.enabled: false

#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /vitam/data/elasticsearch-log
#
# Path to log files:
#
path.logs: /vitam/log/elasticsearch-log

#
# Path for backup/snapshots:
#

#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
# = Disable swapping
bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
#
# Note : if installing to localhost, notably a docker container, we need to bind larger than localhost
network.host: 172.21.225.11
#
# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
#
http.port: 9201
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
# TODO OMA : faire mieux, plus propre et prenant bien en compte is_master de chaque membre
cluster.initial_master_nodes: [ "172.21.225.11" ]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
# https://www.elastic.co/guide/en/elasticsearch/reference/8.13/modules-gateway.html
#gateway.recover_after_nodes: 3
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/8.13/modules-gateway.html>
#
# ---------------------------------- Various -----------------------------------
#
# Allow wildcard deletion of indices:
#
action.destructive_requires_name: true


indices.mapping.dynamic_timeout: 30s

# thread_pool configuration
# https://www.elastic.co/guide/en/elasticsearch/reference/8.13/modules-threadpool.html
thread_pool:
    analyze:
        size: 4
        queue_size: 5000
    get:
        size: 4
        queue_size: 1000
    search:
        size: 7
        queue_size: 1000
    write:
        size: 5
        queue_size: 5000
    warmer:
        core: 1
        max: 2
        keep_alive: 2m

# Note : the 0.5 in the previous expression is for there is only 1 CPU (else the thread pool size would be zero) ! ; Note bis : max 10 threads #
# Note : in ES5 and further : the thread pool "refresh" is of type scaling with a keep-alive of 5m and a max of min(10, (# of available processors)/2)

# related to https://www.elastic.co/guide/en/elasticsearch/reference/8.13/modules-fielddata.html
indices.fielddata.cache.size: 30%

# related to https://www.elastic.co/guide/en/elasticsearch/reference/8.13/circuit-breaker.html#fielddata-circuit-breaker
indices.breaker.fielddata.limit: 40%


indices.breaker.total.use_real_memory: false

# Related to https://www.elastic.co/guide/en/elasticsearch/reference/8.13/ilm-settings.html
indices.lifecycle.history_index_enabled: true

#----------------------- BEGIN SECURITY CONFIGURATION -----------------------

# Enable security features
xpack.security.enabled: false

# Disable watcher features (to send notifications)
xpack.watcher.enabled: false
