On Monday 19 February 2018 22:36:48 Roy Teeuwen wrote: > Hey guys, Hi Roy,
> I am trying to use Elasticsearch in an OSGi environment, which doesn't seem > to be that easy. They have two jars that they provide as clients (since > elasticsearch 5) > > - elasticsearch-rest-client > - elasticsearch-rest-high-level-client [1] > > The first one is a low level api client, it uses apache http client to send > json requests to a elasticsearch cluster. The second one, the high level > client, uses the low level client and has all the marshalling and > unmarshalling of the results included. How this was built though, is by > using the already existing classes before elasticsearch 5, which had a > internal java transport client inside the core elasticsearch project, and > use those to marshall and unmarshall. This way existing clients didn't need > a big migration to the new high level client. > > This of course comes with a downside, if you want to use the high level > client, you have to include the entire elasticsearch jar, and in > consequence all the dependencies, which is a lot more than you want from > just a rest client jar. So what I would like to achieve is to sort of shade > a fatJar which takes the elasticsearch-rest-high-level-client jar, which > only has like 4 java classes!, and calculate all the needed classes to run > those 4 java classes and put them in one fatJar. In the end this shouldn't > be that big of a jar, seeing as its only the GetResponse, GetResult, > SearchHits and classes like that, that will be taken from the core > elasticsearch jar and be included. > > Is there an easy way to achieve this? I know you can inline classes with the > bundle plugin, so it would just need a bit of more "automagic" to make it > work ;) you can try with Conditional-Package, see http://njbartlett.name/2014/05/26/static-linking.html Regards, O. > Greets, > Roy > > [1] > https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java > -rest-high.html > <https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/jav > a-rest-high.html> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

