Installing elasticsearch-image plugin from my repository isn't working

I tried to install elasticsearch-image plugin from https://github.com/kzwang/elasticsearch-image by typing the commands

bin/plugin -install com.github.kzwang/elasticsearch-image/1.2.0
sudo service elasticsearch restart

And when I tried to index images and search for them I've got this Exception

{"error":"MapperParsingException[failed to parse]; nested: NoSuchMethodError[org.elasticsearch.common.io.stream.BytesStreamInput.<init>([BZ)V]; ","status":400}

When I checked for this exception I found an issue here that talks about this exception. https://github.com/kzwang/elasticsearch-image/issues/20

As I searched more, I found that the reason why this exception is appearing is because the class org.elasticsearch.common.io.stream.BytesStreamInput implementation differs between ElasticSearch 1.3.2 AND ElasticSearch 1.7.2

The plugin is built for ElasticSearch 1.3.2, and it uses the class BytesStreamInput in those lines

https://github.com/kzwang/elasticsearch-image/blob/master/src/main/java/org/elasticsearch/index/mapper/image/ImageMapper.java#L258

https://github.com/kzwang/elasticsearch-image/blob/master/src/main/java/org/elasticsearch/index/mapper/image/ImageMapper.java#L344

https://github.com/kzwang/elasticsearch-image/blob/master/src/main/java/org/elasticsearch/index/query/image/ImageQueryParser.java#L117

Which all uses the constructor defined in ElasticSearch 1.3.2

https://github.com/elastic/elasticsearch/blob/v1.3.2/src/main/java/org/elasticsearch/common/io/stream/BytesStreamInput.java#L52

But in ElasticSearch 1.7.2 that constructor is removed and replaced by

https://github.com/elastic/elasticsearch/blob/v1.7.2/src/main/java/org/elasticsearch/common/io/stream/BytesStreamInput.java#L49

So what I did is forking the project

https://github.com/abozanona/elasticsearch-image

and removing the second parameter to be like in lines

https://github.com/abozanona/elasticsearch-image/blob/master/src/main/java/org/elasticsearch/index/mapper/image/ImageMapper.java#L258

https://github.com/abozanona/elasticsearch-image/blob/master/src/main/java/org/elasticsearch/index/mapper/image/ImageMapper.java#L344

https://github.com/abozanona/elasticsearch-image/blob/master/src/main/java/org/elasticsearch/index/query/image/ImageQueryParser.java#L117

Then tried to install the plugin from the forked project

I tried to use this command

sudo /usr/share/elasticsearch/bin/plugin --install com.github.abozanona.elasticsearch-image/1.2.1

But it gives me this error

Failed to install com.github.abozanona.elasticsearch-image/1.2.1, reason: failed to download out of all possible locations

I tried also to run this command

sudo ./plugin --install readonlyrest --url 'https://github.com/abozanona/elasticsearch-image/archive/1.2.1.zip?raw=true'
OR
sudo ./plugin -install abozanona/elasticsearch-image

But it gives me this error

Error while installing plugin, reason: IllegalArgumentException: Plugin installation assumed to be site plugin, but contains source code, aborting installation.

##My question
How can I install the modified plugin from https://github.com/abozanona/elasticsearch-image ?

I assume from your description that you are running elasticsearch 1.7.2? The plugin cli back then was considerably lenient and error prone. You should really upgrade to a modern version, for many other reasons than just that.

With that said, you need to actually compile your fork. The zip that you are getting from github is of the sourcecode, and using that method of an autogenerated zip from github was meant specfically for site plugins (which have been removed since 5.0).

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