# Modify the uri of the incoming request - Rest Filter

**URL:** <https://discuss.elastic.co/t/modify-the-uri-of-the-incoming-request-rest-filter/118978>\
**Category:** Elasticsearch\
**Created:** [February 8, 2018, 6:48am UTC](https://discuss.elastic.co/t/modify-the-uri-of-the-incoming-request-rest-filter/118978 "2018-02-08T06:48:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![SKumarMN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skumarmn/32/27537_2.png) [@SKumarMN](https://discuss.elastic.co/u/SKumarMN)\
**Post date:** [February 8, 2018, 6:48am UTC](https://discuss.elastic.co/t/modify-the-uri-of-the-incoming-request-rest-filter/118978/1 "2018-02-08T06:48:31Z")

</div>

Hi All,

I have a custom plugin which implements **RestHandler** and intercepts the incoming request via the **handleRequest** method.

I have a requirement that if the incoming query uri is like /\*/\_search then i need to replace the uri with certain index names defined in elasticsearch.yml file as white list indexes

for ex: if the incoming uri is /\*/\_search then convert the uri to /index1,index2/\_search

i tried creating new custom RestRequest object by extending RestRequest class and setting the path with the modified uri and then chaining the new RestRequest object

`this.restHandler.handleRequest(newrequest, channel, client);`

However still the query that executed by ES would be /\*/\_search. How can i achieve the above requirement

---

<div class="post-metadata">

**Author:** ![SKumarMN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skumarmn/32/27537_2.png) [@SKumarMN](https://discuss.elastic.co/u/SKumarMN)\
**Post date:** [February 8, 2018, 10:07am UTC](https://discuss.elastic.co/t/modify-the-uri-of-the-incoming-request-rest-filter/118978/2 "2018-02-08T10:07:29Z")

</div>

@experts. Any help you can shed on this

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 8, 2018, 12:43pm UTC](https://discuss.elastic.co/t/modify-the-uri-of-the-incoming-request-rest-filter/118978/3 "2018-02-08T12:43:58Z")

</div>

Read [this](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and specifically the "Also be patient" part.

---

<div class="post-metadata">

**Author:** ![SKumarMN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skumarmn/32/27537_2.png) [@SKumarMN](https://discuss.elastic.co/u/SKumarMN)\
**Post date:** [February 9, 2018, 9:33am UTC](https://discuss.elastic.co/t/modify-the-uri-of-the-incoming-request-rest-filter/118978/4 "2018-02-09T09:33:01Z")

</div>

Sure.. will keep this in my mind for future posts... It would be really helpful if u can help on this.. it's a request

---

<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:** [March 9, 2018, 9:33am UTC](https://discuss.elastic.co/t/modify-the-uri-of-the-incoming-request-rest-filter/118978/5 "2018-03-09T09:33:05Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
