# HTTP Output Failure - Unable to send logstash output to elasticsearch

**URL:** https://discuss.elastic.co/t/http-output-failure-unable-to-send-logstash-output-to-elasticsearch/189974
**Category:** Logstash
**Created:** [July 11, 2019, 10:34am UTC](https://discuss.elastic.co/t/http-output-failure-unable-to-send-logstash-output-to-elasticsearch/189974 "2019-07-11T10:34:48Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Vivek\_Sharma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vivek_sharma/32/46948_2.png) [@Vivek\_Sharma](https://discuss.elastic.co/u/Vivek_Sharma)
#### Post date: [July 11, 2019, 10:34am UTC](https://discuss.elastic.co/t/http-output-failure-unable-to-send-logstash-output-to-elasticsearch/189974/1 "2019-07-11T10:34:49Z")

</div>

Hi

I am trying to parse a text file containing 3 fields and storing the result in elasticsearch using http.

Below is the code I have created for this.

```
input {
  beats {
    port => 5044
	}
}

filter { 
		dissect {
				mapping => { 
					message => "%{empid}##%{empname}##%{hrsworked}" }
			}
}
output {
        http {
            url => "http://localhost:9200/pocind-%{+YYYY.MM.dd}/_doc/%{empid}/_update?retry_on_conflict=5"
            http_method => "post"
            content_type => "application/json"
            format => "message"
            message => '{  
                "script" : {
                    "source": " ctx._source.SAGStatus.add(params.status)" ; ctx._source.SAGTimestampIn = params.timestamp",
                        "lang": "painless",
                        "params" : {
                            "status" : "Viveks",
                        }
                    },
                "upsert" : {"Employee Id" : "%{empid}", "Employee Name" : "%{empname}","Hrs Worked" : "%{hrsworked}", "Emp Status" : ["status"]}
            }'
        }
}

```

But when I parse the logs, i get error as below:

`

`

> [2019-07-11T15:28:54,669][ERROR][logstash.outputs.http] [HTTP Output Failure] Encountered non-2xx HTTP code 400 {:response\_code=\>400, :url=\>"[http://localhost:9200/pocind-2019.07.11/\_doc/305611/\_update?retry\_on\_conflict=5](http://localhost:9200/pocind-2019.07.11/_doc/305611/_update?retry_on_conflict=5)", :event=\>#LogStash::Event:0x257029}

`  
Can anyone please help in on how to get this issue resolved.

Thanks  
Vivek Sharma  
`

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [July 11, 2019, 1:13pm UTC](https://discuss.elastic.co/t/http-output-failure-unable-to-send-logstash-output-to-elasticsearch/189974/2 "2019-07-11T13:13:30Z")

</div>

If elasticsearch is returning an error there is probably a more informative message in the elasticsearch logs.

Can I ask why you are trying to write to elasticsearch using an http output rather than an elasticsearch output?

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [August 8, 2019, 1:13pm UTC](https://discuss.elastic.co/t/http-output-failure-unable-to-send-logstash-output-to-elasticsearch/189974/3 "2019-08-08T13:13:41Z")

</div>

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