# Elasticsearch output plugin fails with "undefined method \`version' for nil:NilClass"

**URL:** <https://discuss.elastic.co/t/elasticsearch-output-plugin-fails-with-undefined-method-version-for-nil-nilclass/27409>\
**Category:** Logstash\
**Created:** [August 14, 2015, 3:31pm UTC](https://discuss.elastic.co/t/elasticsearch-output-plugin-fails-with-undefined-method-version-for-nil-nilclass/27409 "2015-08-14T15:31:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sven\_Beauprez](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@Sven\_Beauprez](https://discuss.elastic.co/u/Sven_Beauprez)\
**Post date:** [August 14, 2015, 3:31pm UTC](https://discuss.elastic.co/t/elasticsearch-output-plugin-fails-with-undefined-method-version-for-nil-nilclass/27409/1 "2015-08-14T15:31:47Z")

</div>

I want to work and extend functionality of the elasticsearch plugin, but I have an issue running the original plugin.

After succesfully building the gem file for the master branch of logstash-output-elasticsearch (output 17,8MB file '`logstash-output-elasticsearch-1.0.7.gem`') and successfully installing the plugin in logstash 1.5.2), I am getting following error when starting logstash (using --debug flag):

```
...
Plugin not defined in namespace, checking for plugin file {:type=>"output", :name=>"elasticsearch", :path=>"logstash/outputs/elasticsearch", :level=>:debug, :file=>"logstash/plugin.rb", :line=>"133", :method=>"lookup"}
[2015-08-14 15:12:46.085] WARN -- Concurrent: [DEPRECATED] Java 7 is deprecated, please use Java 8.
Java 7 support is only best effort, it may not work. It will be removed in next release (1.0).
The error reported is: 
  undefined method 'version' for nil:NilClass
/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.2.2-java/lib/logstash/util/plugin_version.rb:26:in 'find_version!'
/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.2.2-java/lib/logstash/util/plugin_version.rb:36:in `find_plugin_version!'

```

When looking at the code of plugin\_version.rb, it seems it should be able to simple lookup the version within the filename. Correct? (not a lot of ruby experience, so it is an assumption I am making here)

```
def self.find_version!(name)
  begin
    specification = Gem::Specification.find_by_name(name)
    new(specification.version)
  rescue Gem::LoadError
    # Rescuing the LoadError and raise a Logstash specific error.
    # Likely we can't find the gem in the current GEM_PATH
    raise LogStash::PluginNoVersionError
  end
end

```

What could have gone wrong when installing/using my build version of the plugin?

---

<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:31am UTC](https://discuss.elastic.co/t/elasticsearch-output-plugin-fails-with-undefined-method-version-for-nil-nilclass/27409/2 "2017-07-06T05:31:56Z")

</div>


