title: Elasticsearch install custom plugins results in ERROR: `elasticsearch` directory is missing in the plugin zip
body: <p>When I try to install the plugin I built by calling </p>
  
  <pre><code>./elasticsearch-plugin install file:///fullpath/to/zipfile/custome_plugin.zip
  </code></pre>
  
  <p>It gives me this error:</p>
  
  <pre><code>ERROR: `elasticsearch` directory is missing in the plugin zip
  </code></pre>
  
  <p>I was reading some other similar posts and many tried to install a .jar instead of .zip. I did try installing .zip, but this same error still shows.</p>
  
  <p>Additionally (might not be related to this issue), when I manually unzip the zip file and put it into plugin folder, doing <code>elasticsearch-plugins list</code> does list out the custom plugin. In this case the plugin is a custom analyzer, but somehow the mapping doesn't recognize the analyzer. Is it because I did not install it properly? </p>
  
  <p>EDIT:</p>
  
  <p>adding a little info, when I shut down the cluster and then restart after the plugin is manually unzipped and put into the <code>plugin</code> directory, the cluster wouldn't start. I got error that looks like </p>
  
  <pre><code>[2017-08-31T11:15:52,668][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [] fatal error in thread [main], exiting
  java.lang.NoClassDefFoundError: org/elasticsearch/index/analysis/AnalysisModule$AnalysisBinderProcessor
      at java.lang.Class.getDeclaredConstructors0(Native Method) ~[?:1.8.0_65]
      at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671) ~[?:1.8.0_65]
      at java.lang.Class.getConstructor0(Class.java:3075) ~[?:1.8.0_65]
      at java.lang.Class.getConstructor(Class.java:1825) ~[?:1.8.0_65]
      at org.elasticsearch.plugins.PluginsService.loadPlugin(PluginsService.java:423) ~[elasticsearch-5.5.2.jar:5.5.2]
      at org.elasticsearch.plugins.PluginsService.loadBundles(PluginsService.java:387) ~[elasticsearch-5.5.2.jar:5.5.2]
      at org.elasticsearch.plugins.PluginsService.&lt;init&gt;(PluginsService.java:140) ~[elasticsearch-5.5.2.jar:5.5.2]
      at org.elasticsearch.node.Node.&lt;init&gt;(Node.java:312) ~[elasticsearch-5.5.2.jar:5.5.2]
      at org.elasticsearch.node.Node.&lt;init&gt;(Node.java:244) ~[elasticsearch-5.5.2.jar:5.5.2]
      at org.elasticsearch.bootstrap.Bootstrap$5.&lt;init&gt;(Bootstrap.java:232) ~[elasticsearch-5.5.2.jar:5.5.2]
      at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:232) ~[elasticsearch-5.5.2.jar:5.5.2]
      at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:351) ~[elasticsearch-5.5.2.jar:5.5.2]
      at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123) ~[elasticsearch-5.5.2.jar:5.5.2]
      at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:114) ~[elasticsearch-5.5.2.jar:5.5.2]
      at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:67) ~[elasticsearch-5.5.2.jar:5.5.2]
      at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122) ~[elasticsearch-5.5.2.jar:5.5.2]
      at org.elasticsearch.cli.Command.main(Command.java:88) ~[elasticsearch-5.5.2.jar:5.5.2]
      at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.5.2.jar:5.5.2]
      at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.5.2.jar:5.5.2]
  Caused by: java.lang.ClassNotFoundException: org.elasticsearch.index.analysis.AnalysisModule$AnalysisBinderProcessor
      at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[?:1.8.0_65]
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_65]
      at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:814) ~[?:1.8.0_65]
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_65]
      ... 19 more
  </code></pre>
  
  <p>It seems like this Analysis</p>
  
  <p>Is there some library I'm missing?</p>
  
  <p>EDIT 2:
  After some more digging, I found this site</p>
  
  <p><a href="http://snacktrace.com/artifacts/org.elasticsearch/elasticsearch/1.7.3/org.elasticsearch.index.analysis.AnalysisModule" rel="nofollow noreferrer">http://snacktrace.com/artifacts/org.elasticsearch/elasticsearch/1.7.3/org.elasticsearch.index.analysis.AnalysisModule</a>$AnalysisBinderProcessor$AnalyzersBindings</p>
  
  <p>Seems like this <code>AnalyzersBindings</code> is only for ES 1.x and 2.x (&lt;2.4)? I need a way to replace this.</p>
  
  <p>EDIT 3:
  As requested, here's how AnalyzerBinding is used originally</p>
  
  <pre><code>package org.elasticsearch.plugin.analysis.my.analyzer;
  
  import org.elasticsearch.index.analysis.AnalysisModule;
  
  public class AnalyzerBinderProcessor extends AnalysisModule.AnalysisBinderProcessor {
  
      @Override
      public void processAnalyzers(AnalyzersBindings analyzersBindings) {
          analyzersBindings.processAnalyzer("my_name", AnalyzerProvider.class);
      }
  
      @Override
      public void processTokenFilters(TokenFiltersBindings tokenFiltersBindings) {
      }
  }
  </code></pre>
  
  <p>then in my AnalyzerPlugin.java I have</p>
  
  <pre><code>public class AnalyzerPlugin extends Plugin {
      //some other code here that's not related to Binder 
  
      public void onModule(AnalysisModule module) {
          module.addProcessor(new AnalyzerBinderProcessor());
      }
  }
  </code></pre>
  
  <p>EDIT 4: this is neverending.......</p>
  
  <p>if I keep the @Override, it throws</p>
  
  <pre><code>[ERROR] /opt/bg/analytics/src/java/src/analyzer5.0/src/main/java/org/elasticsearch/plugin/analysis/my_analyzer/AnalyzerPlugin.java:[16,5] method does not override or implement a method from a supertype
  </code></pre>
  
  <p>Also, facing an issue of </p>
  
  <pre><code>[ERROR] /opt/bg/analytics/src/java/src/analyzer5.0/src/main/java/org/elasticsearch/plugin/analysis/my_analyzer/AnalyzerPlugin.java:[36,17] onModule(org.elasticsearch.indices.analysis.AnalysisModule) in org.elasticsearch.plugin.analysis.my_analyzer.AnalyzerPlugin cannot override onModule(org.elasticsearch.indices.analysis.AnalysisModule) in org.elasticsearch.plugins.Plugin
  </code></pre>
  
  <p>because <code>overridden method is final</code></p>
  
  <p>Is that an update from old <code>Plugin</code> to new? I'm so lost......</p>
  
  <p>I feel like I need a thorough tutorial of how to create a plugin for custom analyzer, all I can find so far is this</p>
  
  <p><a href="http://david.pilato.fr/blog/2016/10/16/creating-a-plugin-for-elasticsearch-5-dot-0-using-maven-updated-for-ga/" rel="nofollow noreferrer">http://david.pilato.fr/blog/2016/10/16/creating-a-plugin-for-elasticsearch-5-dot-0-using-maven-updated-for-ga/</a></p>
  
  <p>which doesn't help much. Does anyone have a good link?</p>