What's the proper way to upload a plugin?

I packaged a new (better?) Chinese analyzer as a plugin:

However, I'm not sure what's the best way to upload this so that
plugin -install analyzer-smartchinese just works. Right now, you
have to:

plugin -url https://github.com/downloads/thmttch/elasticsearch/elasticsearch-analysis-smartchinese-0.18.0-SNAPSHOT.zip
-install analysis-smartchinese

From reading PluginManager, I don't see anyway to have a different
version number than what ES is using, or am I just being obtuse?

If somebody can help me test it (it works for me, but that never
proves anything), that would be nice as well; this is my first time
hacking on ES.

RE: https://github.com/elasticsearch/elasticsearch/issues/1073

There are two variants to plugins, the first, are the ones that comes built
in elasticsearch, and the others, are ones hosted outside of elasticsearch.

In 0.17, there was push to try and create more external friendly plugin
system. The hope is that the built in plugins in elasticsearch will slowly
move to their own projects (hosted on github) and installed directly from
there.

The idea is that you create the plugin as a project (on github for example).
No need to fork the full elasticsearch codebase, just add it as a dependency
so you can build and package your plugin. You can choose your own build
system (maven, gradle, ant) for that.

The packaging of the plugin should end up generating a zip file that is
similar in nature to the other plugins. The simplest include the plugin and
dependencies jar files within it.

Once you have that, you can upload the zip file to github. You can (and
should) use your own versioning, you don't have to use elasticsearch
versioning (cause then you will need to release a new plugin version each
time elasticsearch is released).

Lets say your username is sexy, and your plugin repo name is beast (on
github).

The file you end up storing on github (under downloads) should be named
something like: beast-0.4.zip (0.4 is the version number). You can
potentially prefix it with either elasticsearch or es, for example:
elasticsearch-beast-0.4.zip. Then, installing it is simple:

bin/plugin -install sexy/beast/0.4

One thing that I would love to get into the elasticsearch repo is a plugin
template, that includes the template files, with build all configured (using
maven or gradle). So you can just get that template and start writing a
plugin easily.

On Tue, Sep 6, 2011 at 1:21 PM, Matt matt.chu@gmail.com wrote:

I packaged a new (better?) Chinese analyzer as a plugin:

https://github.com/thmttch/elasticsearch

However, I'm not sure what's the best way to upload this so that
plugin -install analyzer-smartchinese just works. Right now, you
have to:

plugin -url
https://github.com/downloads/thmttch/elasticsearch/elasticsearch-analysis-smartchinese-0.18.0-SNAPSHOT.zip
-install analysis-smartchinese

From reading PluginManager, I don't see anyway to have a different
version number than what ES is using, or am I just being obtuse?

If somebody can help me test it (it works for me, but that never
proves anything), that would be nice as well; this is my first time
hacking on ES.

RE: Adding SmartChineseAnalyzer to ElasticSearch · Issue #1073 · elastic/elasticsearch · GitHub

On Tue, Sep 6, 2011 at 6:38 AM, Shay Banon kimchy@gmail.com wrote:

The file you end up storing on github (under downloads) should be named
something like: beast-0.4.zip (0.4 is the version number). You can
potentially prefix it with either elasticsearch or es, for example:
elasticsearch-beast-0.4.zip. Then, installing it is simple:
bin/plugin -install sexy/beast/0.4

Github plugins will not accept a filename that starts with "elasticsearch- "
https://github.com/elasticsearch/elasticsearch/blob/master/modules/elasticsearch/src/main/java/org/elasticsearch/plugins/PluginManager.java#L101

The inverse holds true for plugins installed locally.

One thing that I would love to get into the elasticsearch repo is a plugin
template, that includes the template files, with build all configured (using
maven or gradle). So you can just get that template and start writing a
plugin easily.

That would be great. I was thinking about plugins lately and if it was
possible to execute a certain task. I was able to do it and I wanted
to share my results. However, I wanted to write the code in Java
instead of Scala so that more people can understand it. My only
limitation was that I needed to learn gradle (not hard, just did not
have the time). A sample gradle build file for plugins would be
great, especially when it comes to packaging.

--
Ivan

On Tue, Sep 6, 2011 at 4:33 PM, Ivan Brusic ivan@brusic.com wrote:

On Tue, Sep 6, 2011 at 6:38 AM, Shay Banon kimchy@gmail.com wrote:

The file you end up storing on github (under downloads) should be named
something like: beast-0.4.zip (0.4 is the version number). You can
potentially prefix it with either elasticsearch or es, for example:
elasticsearch-beast-0.4.zip. Then, installing it is simple:
bin/plugin -install sexy/beast/0.4

Github plugins will not accept a filename that starts with "elasticsearch-
"

https://github.com/elasticsearch/elasticsearch/blob/master/modules/elasticsearch/src/main/java/org/elasticsearch/plugins/PluginManager.java#L101

The name is just removed so it won't be "installed" using that name, but
just using the descriptive name, the download link will include
elasticsearch-.

The inverse holds true for plugins installed locally.

One thing that I would love to get into the elasticsearch repo is a
plugin
template, that includes the template files, with build all configured
(using
maven or gradle). So you can just get that template and start writing a
plugin easily.

That would be great. I was thinking about plugins lately and if it was
possible to execute a certain task. I was able to do it and I wanted
to share my results. However, I wanted to write the code in Java
instead of Scala so that more people can understand it. My only
limitation was that I needed to learn gradle (not hard, just did not
have the time). A sample gradle build file for plugins would be
great, especially when it comes to packaging.

It doesn't have to be gradle, it can be maven (for the plugin template).
Probably the more common option for people.

--
Ivan

On Tue, Sep 6, 2011 at 9:38 AM, Shay Banon kimchy@gmail.com wrote:

It doesn't have to be gradle, it can be maven (for the plugin template).
Probably the more common option for people.

I just needed an excuse to learn Gradle. :slight_smile: Plus, I have not touched
Maven in over a year and do not want to! Technically, the
scala-build-tool handles Java source files without an issue, but I
would not want anyone to have to download a build system for a simple
plugin.

--
Ivan

How about a plugin template for scala users? Using sbt and all? Thats a
great way forward... .

On Tue, Sep 6, 2011 at 4:47 PM, Ivan Brusic ivan@brusic.com wrote:

On Tue, Sep 6, 2011 at 9:38 AM, Shay Banon kimchy@gmail.com wrote:

It doesn't have to be gradle, it can be maven (for the plugin template).
Probably the more common option for people.

I just needed an excuse to learn Gradle. :slight_smile: Plus, I have not touched
Maven in over a year and do not want to! Technically, the
scala-build-tool handles Java source files without an issue, but I
would not want anyone to have to download a build system for a simple
plugin.

--
Ivan