# Example - ES proxy using finagle and the native client

**URL:** <https://discuss.elastic.co/t/example-es-proxy-using-finagle-and-the-native-client/12337>\
**Category:** Elasticsearch\
**Created:** [June 9, 2013, 3:06pm UTC](https://discuss.elastic.co/t/example-es-proxy-using-finagle-and-the-native-client/12337 "2013-06-09T15:06:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rore](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rore/32/399_2.png) [@rore](https://discuss.elastic.co/u/rore)\
**Post date:** [June 9, 2013, 3:06pm UTC](https://discuss.elastic.co/t/example-es-proxy-using-finagle-and-the-native-client/12337/1 "2013-06-09T15:06:11Z")

</div>

Hi,

I've created an example project showing a proxy server to Elasticsearch  
using Finagle [https://github.com/twitter/finagle](https://github.com/twitter/finagle) (scala/Java).  
You can check out the code here: [https://github.com/rore/finagle-es-proxy](https://github.com/rore/finagle-es-proxy)

The project demonstrates two interesting things:

1. Using the native Java client inside the proxy. Using the native  
client makes the proxy cluster aware and eliminates the need for an  
additional round trip.  
(It also demonstrates how to do a simple HTTP proxy, but that is  
trivial. Using the native client requires a small hack - you need to pass  
the request to the REST controller of Elasticsearch, provide it with a mock  
channel to capture the response and return it in through the proxy.)
2. Creating an authorization filter as part of the finagle service  
chain. This allows the proxy to function as an authentication layer in  
front of Elasticsearch for securing it.  
Since the proxy uses the native client, using it as an authentication  
layer has a minimal overhead.

Hope you find it useful.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 2:32am UTC](https://discuss.elastic.co/t/example-es-proxy-using-finagle-and-the-native-client/12337/2 "2017-07-06T02:32:03Z")

</div>

Closed on July 6, 2017, 2:32am UTC


