If you are indexing large amounts of time-series data, you might also want to
configure Metricbeat to use index lifecycle management. For more information
about configuring and using index lifecycle management with Metricbeat, see
Set up index lifecycle management.

The list of Elasticsearch nodes to connect to. The events are distributed to
these nodes in round robin order. If one node becomes unreachable, the event is
automatically sent to another node. Each Elasticsearch node can be defined as a URL or IP:PORT.
For example: http://192.15.3.2, https://es.found.io:9230 or 192.24.3.2:9300.
If no port is specified, 9200 is used.

When a node is defined as an IP:PORT, the scheme and path are taken from the
protocol and path config options.

The number of workers per configured host publishing events to Elasticsearch. This
is best used with load balancing mode enabled. Example: If you have 2 hosts and
3 workers, in total 6 workers are started (3 for each host).

The name of the protocol Elasticsearch is reachable on. The options are:
http or https. The default is http. However, if you specify a URL for
hosts, the value of protocol is overridden by whatever scheme you
specify in the URL.

The URL of the proxy to use when connecting to the Elasticsearch servers. The
value may be either a complete URL or a "host[:port]", in which case the "http"
scheme is assumed. If a value is not specified through the configuration file
then proxy environment variables are used. See the
Go documentation
for more information about the environment variables.

The index name to write events to. The default is
"metricbeat-%{[beat.version]}-%{+yyyy.MM.dd}" (for example,
"metricbeat-6.6.2-2019-09-13"). If you change this setting, you also
need to configure the setup.template.name and setup.template.pattern options
(see Load the Elasticsearch index template).
If you are using the pre-built Kibana
dashboards, you also need to set the setup.dashboards.index option (see
Load the Kibana dashboards).

You can set the index dynamically by using a format string to access any event
field. For example, this configuration uses a custom field, fields.log_type,
to set the index:

We recommend including beat.version in the name to avoid mapping issues
when you upgrade.

With this configuration, all events with log_type: normal are sent to an
index named normal-6.6.2-2019-09-13, and all events with
log_type: critical are sent to an index named
critical-6.6.2-2019-09-13.

An array of index selector rules. Each rule specifies the index to use for
events that match the rule. During publishing, Metricbeat uses the first
matching rule in the array. Rules can contain conditionals, format string-based
fields, and name mappings. If the indices setting is missing or no rule
matches, the index setting is used.

Rule settings:

index

The index format string to use. If this string contains field
references, such as %{[fields.name]}, the fields must exist, or the rule fails.

mappings

A dictionary that takes the value returned by index and maps it
to a new name.

default

The default string value to use if mappings does not find a
match.

when

A condition that must succeed in order to execute the current rule.
All the conditions supported by processors are also supported
here.

The following example sets the index based on whether the message field
contains the specified string:

You can set the ingest node pipeline dynamically by using a format string to
access any event field. For example, this configuration uses a custom field,
fields.log_type, to set the pipeline for each event:

An array of pipeline selector rules. Each rule specifies the ingest node
pipeline to use for events that match the rule. During publishing, Metricbeat
uses the first matching rule in the array. Rules can contain conditionals,
format string-based fields, and name mappings. If the pipelines setting is
missing or no rule matches, the pipeline setting is
used.

Rule settings:

pipeline

The pipeline format string to use. If this string contains field
references, such as %{[fields.name]}, the fields must exist, or the rule
fails.

mappings

A dictionary that takes the value returned by pipeline and maps
it to a new name.

default

The default string value to use if mappings does not find a
match.

when

A condition that must succeed in order to execute the current rule.
All the conditions supported by processors are also supported
here.

The following example sends events to a specific pipeline based on whether the
message field contains the specified string:

The number of seconds to wait before trying to reconnect to Elasticsearch after
a network error. After waiting backoff.init seconds, Metricbeat tries to
reconnect. If the attempt fails, the backoff timer is increased exponentially up
to backoff.max. After a successful connection, the backoff timer is reset. The
default is 1s.