Elasticsearch bulk request enhancements#5811
Conversation
eecce76 to
5bcc5c3
Compare
ruflin
left a comment
There was a problem hiding this comment.
That is a really nice addition. I left a few minor comments.
There was a problem hiding this comment.
Similar comment to other PR: Should we really allow here interface or make sure this is converted to a string? Do we know the key "id" exists in m ?
There was a problem hiding this comment.
can _id be a number instead of a string?
There was a problem hiding this comment.
I'm assuming that _id on the ES side is a keyword. So if 12 is put in it ends up also as "12". Even if that is not the case, I think we should enforce string values on beats side.
|
@urso Needs a rebase. |
- Log error and drop event if no index name can be computed (ES API returns error if index is empty) - Set `_id` if event.Meta["id"] is set - Use `index` action if no `id` is set and `create` if `id` is set.
933da88 to
93aaea6
Compare
| errNoTimestamp = errors.New("value is no timestamp") | ||
| ) | ||
|
|
||
| func (e *Event) SetID(id string) { |
There was a problem hiding this comment.
exported method Event.SetID should have comment or be unexported
|
@ruflin rebased and ensure |
Add support to configure a key for setting the document ID in the harvester JSON settings. The ID will be store in the events Meta["id"] for the output to pick up. With elastic#5811 will the elasticsearch output is the Meta["id"] field to set the document its ID (uses op_type="create" to count duplicate inserts of same ID). For other output type, the document ID will be forwarded via `@metadata.id`.
* Add support to set the document ID in the filebeat json reader Add support to configure a key for setting the document ID in the harvester JSON settings. The ID will be store in the events Meta["id"] for the output to pick up. With #5811 will the elasticsearch output is the Meta["id"] field to set the document its ID (uses op_type="create" to count duplicate inserts of same ID). For other output type, the document ID will be forwarded via `@metadata.id`.
Requires: #5810
returns error if index is empty)
_idif event.Meta["id"] is setindexaction if noidis set andcreateifidis set.