Watcher not able to post bulk data into elastic


(Umesh Toranagatti) #1

I am facing one issue watcher watcher,

I have a query which returns list of “servername” and “datatype”


I want to insert this data back to elasticsearch using bulk insert(I am using Kibana DevTools).

When I tried with post it works fine,
POST statuslogs/messages/_bulk

Same this I am trying to pass in watcher action
"actions": {
"elastic_webhook": {
"webhook": {
"method": "POST",
"host": "localhost",
"port": 9200,
"path": "statuslogs/messages/_bulk",
"headers": {
"Accept": "application/json",
"Content-Type": "application/json"
"auth": {
"basic": {
"username": "elastic",
"password": "changeme"
"body": """{"index":{}}\n{"Servername":"2","datatype":"AuditJobBacklog"}\n{"index":{}}\n{"Servername":"3","datatype":"AuditJobBacklog"}\n\n"""

when it gets executed it is throwing an error
"body": """{"error":{"root_cause":[{"type":"action_request_validation_exception","reason":"Validation Failed: 1: no requests added;"}],"type":"action_request_validation_exception","reason":"Validation Failed: 1: no requests added;"},"status":400}"""

I read blobs about this error, in most of the places error caused because of newline. I tried many ways by putting newline in different places. Still I am not able to post the data.

With single data I am able to send to elastic. I am facing problem with bulk insert.

Please help me in solving this issue.


(Alexander Reelsen) #2

Instead of creating a bulk request yourself you can use the index action, which already supports indexing several documents.

See the docs about multi document support:

(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.