# RestFilters for ES 5.x

**URL:** <https://discuss.elastic.co/t/restfilters-for-es-5-x/134123>\
**Category:** Elasticsearch\
**Created:** [June 1, 2018, 1:52am UTC](https://discuss.elastic.co/t/restfilters-for-es-5-x/134123 "2018-06-01T01:52:09Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![s1monw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/s1monw/32/3637_2.png) [@s1monw](https://discuss.elastic.co/u/s1monw)\
**Post date:** [June 5, 2018, 7:10am UTC](https://discuss.elastic.co/t/restfilters-for-es-5-x/134123/6 "2018-06-05T07:10:00Z")

</div>

you have to return a factory like this:

```
UnaryOperator<RestHandler> getRestHandlerWrapper(ThreadContext threadContext) {
    return originalHanlder ->
        (RestHandler) (request, channel, client) -> {
            System.out.println("Log Something");
            originalHanlder.handleRequest(request, channel, client);
        };
}
```

---

_[View the full topic](https://discuss.elastic.co/t/restfilters-for-es-5-x/134123)._
