Elasticsearch Java Client


(Venkatesh) #1

I am trying to write my first java client to query the index and aggregate and store the result in another index.

I have downloaded the ES 5.0 and the lib inside that.

Can a Build a simple project (a standalone java application) without using maven with the jar files in the lib folder !!

I have never used maven or others - So can I just develop without those !!

BTW - I have tried to create a maven project with the help of google in netbeans with the following dependencies
<

org.elasticsearch
elasticsearch
5.0.0


org.elasticsearch.client
transport
5.0.0


org.apache.logging.log4j
log4j-api
2.7
test


org.apache.logging.log4j
log4j-core
2.7
test

However it is unable to locate the class PreBuiltTransportClient

Thanks


(Nik Everett) #2

If you want to develop in Java you should use something like maven or gradle or ant/ivy or something to resolve the dependencies. If you refuse to use those tools you are still going to need to understand them because they are so common that people will explain things in those terms.

If you don't want to use maven then use maven to resolve the dependencies and then copy the libraries it lists as dependencies to your dependencies directory.


(Xavier Facq) #3

Read this maybe : 5.0 alpha 5 Java API: PreBuiltTransportClient class missing


(Venkatesh) #4

Hi
Thanks for your explanation. I am not a skilled java developer and more from support domain, hence don't know these tools or frameworks. However know the bit of core java programming.
Wanted to check if I can just download all the dependent jar files and put them in a lib folder and class path and start developing.
Is there any way to do this.. Or does it mention list of all required jars and location to download.


(Nik Everett) #5

Yeah, the way to do this is to resolve the dependencies using something like maven or ivy or gradle or sbt. There isn't a master list.


(Venkatesh) #6

Thanks. I figured it out and could successfully test the java client.


(Jason Tedor) #7

You should use version 2.6.2 of the Log4j dependencies for version 5.0.0 of Elasticsearch, otherwise you will see NoClassDefFoundErrors for org.apache.logging.log4j.core.async.DaemonThreadFactory.


(system) #8