I'm creating a Java plugin for Elasticsearch version 7.17.6.
The zip file is built using:
gradle distZip
When the generated zip file is unzipped all files, including plugin-descriptor.properties, are in the root folder.
This command is run to install the plugin:
elasticsearch-plugin install file:///plugins/elasticsearch_plugin-1.0.zip -v
However the plugin installation fails with:
sh-5.0# elasticsearch-plugin install file:/plugins/elasticsearch_plugin-1.0.zip -v
-> Installing file:/plugins/elasticsearch_plugin-1.0.zip
-> Downloading file:/plugins/elasticsearch_plugin-1.0.zip
Retrieving zip from file:/plugins/elasticsearch_plugin-1.0.zip
[=================================================] 100%??
-> Failed installing file:/plugins/elasticsearch_plugin-1.0.zip
-> Rolling back file:/plugins/elasticsearch_plugin-1.0.zip
-> Rolled back file:/plugins/elasticsearch_plugin-1.0.zip
Exception in thread "main" java.nio.file.NoSuchFileException: /usr/share/elasticsearch/plugins/.installing-4054247711532660111/plugin-descriptor.properties
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:218)
at java.base/java.nio.file.Files.newByteChannel(Files.java:380)
at java.base/java.nio.file.Files.newByteChannel(Files.java:432)
at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:422)
at java.base/java.nio.file.Files.newInputStream(Files.java:160)
at org.elasticsearch.plugins.PluginDescriptor.readFromProperties(PluginDescriptor.java:183)
at org.elasticsearch.plugins.cli.InstallPluginAction.loadPluginInfo(InstallPluginAction.java:827)
at org.elasticsearch.plugins.cli.InstallPluginAction.installPlugin(InstallPluginAction.java:887)
at org.elasticsearch.plugins.cli.InstallPluginAction.execute(InstallPluginAction.java:245)
at org.elasticsearch.plugins.cli.InstallPluginCommand.execute(InstallPluginCommand.java:88)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112)
at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:95)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112)
at org.elasticsearch.cli.Command.main(Command.java:77)
at org.elasticsearch.plugins.cli.PluginCli.main(PluginCli.java:36)
What can be the cause of the issue? plugin-descriptor.properties exists in the zip file in the root folder but when extracted as part of the install process it is not finding it.
plugin-descriptor.properties contains:
type=isolated
description=My custom plugin for Elasticsearch
version=1.0.0
name=myplugin
classname=com.example.MyPlugin
java.version=1.8
elasticsearch.version=7.17.6
*** Update ***
I found a temporary workaround by copying the zip file to the docker container, extracting it and then moving the extracted folder to
/usr/share/elasticsearch/plugins
and restarting the container. The plugin is then loaded and works as expected.