Addressing customer REST end-point using java API


#1

Is there a simple way to address the custom end-point exposed by my plugin (e.g. /_myplugin/ping) using the java API? The plugin installs correctly and I can test it using curl, but I would like to be able to do this in java so I can build some tests.


(Jörg Prante) #2

In https://github.com/jprante/elasticsearch-xml/blob/master/src/test/java/org/xbib/elasticsearch/integration/AbstractNodesTests.java you can study how to obtain the HTTP address of a node for plugin tests in a junit test.


#3

Many thanks - I was trying something along the same lines but it was good to have confirmation. I was hoping to find a way to access a custom plugin without http calls (i.e. using the java API) but I guess that is not possible.


(Jörg Prante) #4

What Java API do you mean? If you want to access the HTTP REST endpoint, you must use the HTTP URL, and there are many Java APIs for HTTP client methods, e.g. java.net.URL in the JDK.

If you have ES actions implemented in the plugin, you don't need HTTP REST at all.


#5

Sorry, I wasn't being clear - I mean the ES java API. I would like to be able to do something like this:

client.preparePlugin("myplugin")...

but as the permutations for custom plugins are pretty much endless, that would be unrealistic. So I'll stick with java Http calls.


(system) #6