:plugin: es_bulk
:type: codec

///////////////////////////////////////////
START - GENERATED VARIABLES, DO NOT EDIT!
///////////////////////////////////////////
:version: %VERSION%
:release_date: %RELEASE_DATE%
:changelog_url: %CHANGELOG_URL%
:include_path: ../../../../logstash/docs/include
///////////////////////////////////////////
END - GENERATED VARIABLES, DO NOT EDIT!
///////////////////////////////////////////

[id="plugins-{type}s-{plugin}"]

=== Es_bulk codec plugin

include::{include_path}/plugin_header.asciidoc[]

==== Description

This codec will decode the {ref}/docs-bulk.html[Elasticsearch bulk format]
into individual events, plus metadata into the `@metadata` field.

Encoding is not supported at this time as the Elasticsearch
output submits Logstash events in bulk format.

[id="plugins-{type}s-{plugin}-codec-settings"] 
==== Codec settings in the `logstash-input-http` plugin 

The {logstash-ref}/plugins-inputs-http.html[input-http] plugin has two
configuration options for codecs: `codec` and `additional_codecs`. 

Values in `additional_codecs` are prioritized over those specified in the
`codec` option. That is, the default `codec` is applied only if no codec
for the request's content-type is found in the `additional_codecs` setting.

[id="plugins-{type}s-{plugin}-ecs_metadata"]
==== Event Metadata and the Elastic Common Schema (ECS)

When ECS compatibility is disabled, the metadata is stored in the `[@metadata]` field.
When ECS is enabled, the metadata is stored in the `[@metadata][codec][es_bulk]` field.

[id="plugins-{type}s-{plugin}-options"]
==== ES Bulk Codec Configuration Options

[cols="<,<,<",options="header",]
|=======================================================================
|Setting |Input type|Required
| <<plugins-{type}s-{plugin}-ecs_compatibility>> | <<string,string>>|No
| <<plugins-{type}s-{plugin}-target>> |<<string,string>>|No
|=======================================================================

[id="plugins-{type}s-{plugin}-ecs_compatibility"]
===== `ecs_compatibility`

* Value type is <<string,string>>
* Supported values are:
** `disabled`: unstructured metadata added at @metadata
** `v1`: uses `[@metadata][codec][es_bulk]` fields

Controls this plugin's compatibility with the {ecs-ref}[Elastic Common Schema (ECS)].

[id="plugins-{type}s-{plugin}-target"]
===== `target`

* Value type is <<string,string>>
* There is no default value for this setting.

Define the target field for placing the values. If this setting is not
set, the data will be stored at the root (top level) of the event.

For example, if you want data to be put under the `document` field:
[source,ruby]
----------------------------------
input {
  kafka {
    codec => es_bulk {
        target => "[document]"
    }
  }
}
----------------------------------