dropwizard-elasticsearch icon indicating copy to clipboard operation
dropwizard-elasticsearch copied to clipboard

Added a provider to allow the ES client to be accessed via the resource request scope

Open jamhall opened this issue 7 years ago • 3 comments

Hello,

You can now access the client via the the request scope:

By registering the provider in the application run method:

environment.jersey().register(EsProvider.binder(managedClient));

You will be able to access the client via an injected parameter in the resource method:

public List<Message> getMessages(@Context Client es) {
    SearchResponse response = es.prepareSearch etc.
}

Please let me know If I haven't correctly implemented the provider...

Thank you for the project!

jamhall avatar Jul 19 '16 09:07 jamhall

Coverage Status

Coverage decreased (-7.2%) to 72.18% when pulling 0a5f469d3c6bb5bc60d36082236075a06ea0a65a on jamhall:master into 5a8e637aa595cf95a04bdc18873e0d6b4f93935e on dropwizard:master.

coveralls avatar Jul 19 '16 09:07 coveralls

Coverage Status

Coverage decreased (-7.2%) to 72.18% when pulling 0a5f469d3c6bb5bc60d36082236075a06ea0a65a on jamhall:master into 5a8e637aa595cf95a04bdc18873e0d6b4f93935e on dropwizard:master.

coveralls avatar Jul 19 '16 09:07 coveralls

Coverage Status

Coverage decreased (-6.6%) to 72.727% when pulling 6112eb51073328520d0c58cd2d69468b7b1aa546 on jamhall:master into 5a8e637aa595cf95a04bdc18873e0d6b4f93935e on dropwizard:master.

coveralls avatar Jul 19 '16 09:07 coveralls