Skip to content

Commit

Permalink
Always send _type to Monitoring Bulk API (elastic#11217)
Browse files Browse the repository at this point in the history
The Monitoring Bulk API (`POST _xpack/monitoring/_bulk`) does not interpret `_type` in the bulk metadata the same was as the regular Bulk API (`POST _bulk`). In the case of the Monitoring Bulk API, `_type` has a special meaning. It does not correspond to the Elasticsearch document `_type` but rather a `type` field within monitoring documents. The `_type` of those monitoring documents gets automatically set to `_doc` by the Monitoring Bulk API.

Therefore, the Beats monitoring code should always send `_type` to the Monitoring Bulk API.
  • Loading branch information
ycombinator authored Mar 13, 2019
1 parent d27417b commit ac72b5c
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions libbeat/monitoring/report/elasticsearch/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ func (c *publishClient) Publish(batch publisher.Batch) error {
meta := common.MapStr{
"_index": "",
"_routing": nil,
}
if c.es.GetVersion().Major < 7 {
meta["_type"] = t
"_type": t,
}
bulk := [2]interface{}{
common.MapStr{"index": meta},
Expand Down

0 comments on commit ac72b5c

Please sign in to comment.