I was wondering if is it somehow possible to make an ES 1.3.1 plugin run the Client API so I can perform ES searching along my ElasticSearch plugin?
I have tried the following code:
package org.elasticsearch.plugin.example;
import org.elasticsearch.common.collect.Lists;
import org.elasticsearch.common.inject.Module;
import org.elasticsearch.plugins.AbstractPlugin;
import java.util.Collection;
import org.elasticsearch.client.Client;
import org.elasticsearch.node.Node;
import org.elasticsearch.node.NodeBuilder;
public class ExamplePlugin extends AbstractPlugin {
@Override public String name() { return "example-plugin"; }
@Override public String description() { return "Example Plugin Description"; }
@Override public Collection<Class<? extends Module>> modules() {
//Trying to create a client to perform searching
Client client = NodeBuilder.nodeBuilder().client(true).node().client();
//returns error java.lang.AutoCloseable [not found];
Collection<Class<? extends Module>> modules = Lists.newArrayList();
modules.add(ExampleRestModule.class);
return modules;
}
}
but it returns the following compile error:
[ERROR] class file for java.lang.AutoCloseable not found
Any ideas on how to make it work?
Installation details:
$ elasticsearch -v
Version: 1.3.1, Build: 2de6dc5/2014-07-28T14:45:15Z, JVM: 1.8.0_11
$ java -version
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)
Source:
The current file structure containing pom.xml file is located here.
pom.xmlfile. I have to agree with you guys thinking there might be something wrong with it. I’m just not sure why since Java is a completely new world for me :/ @coffeeaddict, you have mentioned theJAVA_HOMEfor maven, do you know how can I check that? Thanks