Deploy Elasticsearch Rest Client into OSGi


Up until Elasticsearch 5.0.0 alpha 4 the official Elasticsearch Java client required the complete Elasticsearch distributable included in your application. Although there are several alternative clients available, the new Java Rest Client brings most of the functionallity bundled in a small package.

Since the artifact published by elastic does not contain the required OSGi bundle information I created a wrapper you can find on Github1.


All dependencies are inherited from the RestClient and available as OSGi Bundles:

  • org.apache.httpcomponents:httpasyncclient
  • org.apache.httpcomponents:httpcore-nio
  • org.apache.httpcomponents:httpclient
  • org.apache.httpcomponents:httpcore
  • commons-codec:commons-codec
  • commons-logging:commons-logging

If you deploy the bundle into an AEM instance (>=6.1), you only have to install the httpasyncclient2 (version 4.0.2 should be fine).


I have not published the wrapper into Maven Central yet, therefor you have to checkout the Repository manually and then install the Bundle using Maven.

  mvn clean install sling:install -Dsling.url=http://localhost:4502/system/console


You can now use the dependency in your projects.



  1. Elasticsearch-Rest-OSGi on Github ↩︎

  2. httpasyncclient-osgi ↩︎