<commit_before>[[modules-gateway-local]]
=== Local Gateway

The local gateway allows for recovery of the full cluster state and
indices from the local storage of each node, and does not require a
common node level shared storage.

Note, different from shared gateway types, the persistency to the local
gateway is *not* done in an async manner. Once an operation is
performed, the data is there for the local gateway to recover it in case
of full cluster failure.

It is important to configure the `gateway.recover_after_nodes` setting
to include most of the expected nodes to be started after a full cluster
restart. This will insure that the latest cluster state is recovered.
For example:

[source,js]
--------------------------------------------------
gateway:
    recover_after_nodes: 1
    recover_after_time: 5m
    expected_nodes: 2
--------------------------------------------------

Note, to backup/snapshot the full cluster state it is recommended that
the local storage for all nodes be copied (in theory not all are
required, just enough to guarantee a copy of each shard has been copied,
i.e. depending on the replication settings) while disabling flush.
Shared storage such as S3 can be used to keep the different nodes'
copies in one place, though it does comes at a price of more IO.<commit_msg>[DOCS] Documented gateway.local.auto_import_dangled<commit_after>[[modules-gateway-local]]
=== Local Gateway

The local gateway allows for recovery of the full cluster state and
indices from the local storage of each node, and does not require a
common node level shared storage.

Note, different from shared gateway types, the persistency to the local
gateway is *not* done in an async manner. Once an operation is
performed, the data is there for the local gateway to recover it in case
of full cluster failure.

It is important to configure the `gateway.recover_after_nodes` setting
to include most of the expected nodes to be started after a full cluster
restart. This will insure that the latest cluster state is recovered.
For example:

[source,js]
--------------------------------------------------
gateway:
    recover_after_nodes: 1
    recover_after_time: 5m
    expected_nodes: 2
--------------------------------------------------

[float]
==== Dangling indices

When a node joins the cluster, any shards/indices stored in its  local `data/`
directory which do not already exist in the cluster will be imported into the
cluster by default.  This functionality has two purposes:

1. If a new master node is started which is unaware of the other indices in
   the cluster, adding the old nodes will cause the old indices to be
   imported, instead of being deleted.

2. An old index can be added to an existing cluster by copying it to the
   `data/` directory of a new node, starting the node and letting it join
   the cluster. Once the index has been replicated to other nodes in the
   cluster, the new node can be shut down and removed.

The import of dangling indices can be controlled with the
`gateway.local.auto_import_dangled` which accepts:

[horizontal]
`yes`::

    Import dangling indices into the cluster (default).

`close`::

    Import dangling indices into the cluster state, but leave them closed.

`no`::

    Delete dangling indices after `gateway.local.dangling_timeout`, which
    defaults to 2 hours.
{'fraction_non_alphanumeric': 0.10131500298864315, 'fraction_numerical': 0.002988643156007173, 'mean_word_length': 3.18375, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5927298', 'n_tokens_mistral': 839, 'n_tokens_neox': 808, 'n_words': 477}