# \[1.5.0\] elasticsearch output error

**URL:** <https://discuss.elastic.co/t/1-5-0-elasticsearch-output-error/2105>\
**Category:** Logstash\
**Created:** [June 7, 2015, 10:34pm UTC](https://discuss.elastic.co/t/1-5-0-elasticsearch-output-error/2105 "2015-06-07T22:34:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bezalel\_Lim](https://avatars.discourse-cdn.com/v4/letter/b/a3d4f5/32.png) [@Bezalel\_Lim](https://discuss.elastic.co/u/Bezalel_Lim)\
**Post date:** [June 7, 2015, 10:34pm UTC](https://discuss.elastic.co/t/1-5-0-elasticsearch-output-error/2105/1 "2015-06-07T22:34:57Z")

</div>

I've got such error messages and cannot send log data to elasticsearch server maybe after updating java from Java 7 to Java 8..

* * *

## {:timestamp=\>"2015-06-05T10:18:17.134000+0000", :message=\>"Got error to send bulk of actions to elasticsearch server at [logsene-receiver.sematext.com](http://logsene-receiver.sematext.com) : undefined method `map' for \"items\":String", :level=>:error} {:timestamp=>"2015-06-05T10:18:17.134000+0000", :message=>"Failed to flush outgoing items", :outgoing_count=>1, :exception=>#<NoMethodError: undefined method`map' for "items":String\>, :backtrace=\>["/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-0.2.4-java/lib/logstash/outputs/elasticsearch/protocol.rb:93:in `normalize_bulk_response'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-0.2.4-java/lib/logstash/outputs/elasticsearch/protocol.rb:108:in`bulk'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-0.2.4-java/lib/logstash/outputs/elasticsearch.rb:437:in `submit'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-0.2.4-java/lib/logstash/outputs/elasticsearch.rb:462:in`flush'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/stud-0.0.19/lib/stud/buffer.rb:219:in `buffer_flush'", "org/jruby/RubyHash.java:1341:in`each'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/stud-0.0.19/lib/stud/buffer.rb:216:in `buffer_flush'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/stud-0.0.19/lib/stud/buffer.rb:193:in`buffer\_flush'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/stud-0.0.19/lib/stud/buffer.rb:159:in `buffer_receive'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-0.2.4-java/lib/logstash/outputs/elasticsearch.rb:426:in`receive'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.0-java/lib/logstash/outputs/base.rb:88:in `handle'", "(eval):31:in`output\_func'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.0-java/lib/logstash/pipeline.rb:244:in `outputworker'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.0-java/lib/logstash/pipeline.rb:166:in`start\_outputs'"], :level=\>:warn} {:timestamp=\>"2015-06-05T10:18:18.236000+0000", :message=\>"Got error to send bulk of actions to elasticsearch server at [logsene-receiver.sematext.com](http://logsene-receiver.sematext.com) : undefined method `map' for \"items\":String", :level=>:error} {:timestamp=>"2015-06-05T10:18:18.237000+0000", :message=>"Failed to flush outgoing items", :outgoing_count=>1, :exception=>#<NoMethodError: undefined method`map' for "items":String\>, :backtrace=\>["/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-0.2.4-java/lib/logstash/outputs/elasticsearch/protocol.rb:93:in `normalize_bulk_response'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-0.2.4-java/lib/logstash/outputs/elasticsearch/protocol.rb:108:in`bulk'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-0.2.4-java/lib/logstash/outputs/elasticsearch.rb:437:in `submit'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-0.2.4-java/lib/logstash/outputs/elasticsearch.rb:462:in`flush'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/stud-0.0.19/lib/stud/buffer.rb:219:in `buffer_flush'", "org/jruby/RubyHash.java:1341:in`each'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/stud-0.0.19/lib/stud/buffer.rb:216:in `buffer_flush'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/stud-0.0.19/lib/stud/buffer.rb:193:in`buffer\_flush'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/stud-0.0.19/lib/stud/buffer.rb:159:in `buffer_receive'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-0.2.4-java/lib/logstash/outputs/elasticsearch.rb:426:in`receive'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.0-java/lib/logstash/outputs/base.rb:88:in `handle'", "(eval):31:in`output\_func'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.0-java/lib/logstash/pipeline.rb:244:in `outputworker'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.0-java/lib/logstash/pipeline.rb:166:in`start\_outputs'"], :level=\>:warn}

my logstash setting is below

input {  
tcp {  
type =\> "lsAALog"  
port =\> 4560  
codec =\> json\_lines  
}  
}

output {  
if [logType] == "AA" {  
elasticsearch {  
protocol =\> "http"  
ssl =\> "true"  
host =\> "[logsene-receiver.sematext.com](http://logsene-receiver.sematext.com)"  
port =\> 443  
index =\> "12ekgiuyg2-42e1-lkjkd1duygaiswd-xxxxx"  
manage\_template =\> false  
}  
} else if [logType] == "USR" {  
elasticsearch {  
protocol =\> "http"  
ssl =\> "true"  
host =\> "[logsene-receiver.sematext.com](http://logsene-receiver.sematext.com)"  
port =\> 443  
index =\> "7d03a35a-87fd-asdf2ef2iu1h2ekyg-xxxxx"  
manage\_template =\> false  
}  
} else {  
elasticsearch {  
protocol =\> "http"  
ssl =\> "true"  
host =\> "[logsene-receiver.sematext.com](http://logsene-receiver.sematext.com)"  
port =\> 443  
index =\> "1ekyg12euyg-488e-fcb4b8c4a2b1-xxxxx"  
manage\_template =\> false  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![Bezalel\_Lim](https://avatars.discourse-cdn.com/v4/letter/b/a3d4f5/32.png) [@Bezalel\_Lim](https://discuss.elastic.co/u/Bezalel_Lim)\
**Post date:** [June 8, 2015, 2:33am UTC](https://discuss.elastic.co/t/1-5-0-elasticsearch-output-error/2105/2 "2015-06-08T02:33:18Z")

</div>

I found logstash bug in logstash/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-0.2.4-java/lib/logstash/outputs/elasticsearch/protocol.rb:93

bulk\_response variable is just a JSON formatted String object not hash(map)

I inserted JSON parsing codes and I've tested it works well.

This is bulk method that I've inserted JSON parsing codes

```
require 'rubygems'
require 'json'
...
      def bulk(actions)
        bulk_response = @client.bulk(:body => actions.collect do |action, args, source|
          if source
            next [{ action => args }, source]
          else
            next { action => args }
          end
        end.flatten)
        
        if bulk_response.kind_of? String 
          bulk_response = JSON.parse(bulk_response)
        end
        self.class.normalize_bulk_response(bulk_response)
      end # def bulk
```

---

<div class="post-metadata">

**Author:** ![talevy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/talevy/32/44896_2.png) [@talevy](https://discuss.elastic.co/u/talevy)\
**Post date:** [August 10, 2015, 6:44pm UTC](https://discuss.elastic.co/t/1-5-0-elasticsearch-output-error/2105/3 "2015-08-10T18:44:23Z")

</div>

I am not seeing this behavior using Java 8.

can you try updating to the latest plugin version via

```bash
bin/plugin update logstash-output-elasticsearch

```

the `@client` client is the [Elasticsearch Ruby Client](https://github.com/elastic/elasticsearch-ruby), so I am not sure how  
the data type of the response has become a String.

---

<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:** [July 6, 2017, 5:32am UTC](https://discuss.elastic.co/t/1-5-0-elasticsearch-output-error/2105/4 "2017-07-06T05:32:26Z")

</div>


