# Unittest: RestFilter gets not invoked when using internal client or transportclient

**URL:** <https://discuss.elastic.co/t/unittest-restfilter-gets-not-invoked-when-using-internal-client-or-transportclient/14058>\
**Category:** Elasticsearch\
**Created:** [October 22, 2013, 3:56pm UTC](https://discuss.elastic.co/t/unittest-restfilter-gets-not-invoked-when-using-internal-client-or-transportclient/14058 "2013-10-22T15:56:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hendrik](https://avatars.discourse-cdn.com/v4/letter/h/839c29/32.png) [@Hendrik](https://discuss.elastic.co/u/Hendrik)\
**Post date:** [October 22, 2013, 3:56pm UTC](https://discuss.elastic.co/t/unittest-restfilter-gets-not-invoked-when-using-internal-client-or-transportclient/14058/1 "2013-10-22T15:56:43Z")

</div>

I have written a RestFilter and i want to add some unit tests to test it.  
But it seems that the RestFilter gets not invoked from the unittest.

[2013-10-22 17:48:54,340][INFO][org.elasticsearch.node] [Nocturne]  
version[0.90.5], pid[9456], build[c8714e8/2013-09-17T12:50:20Z]  
[2013-10-22 17:48:54,340][INFO][org.elasticsearch.node] [Nocturne]  
initializing ...  
[2013-10-22 17:48:54,346][DEBUG][org.elasticsearch.plugins.security]  
Starting Security Plugin  
[2013-10-22 17:48:54,351][INFO][org.elasticsearch.plugins] [Nocturne]  
loaded [elasticsearch-my-plugin], sites []  
[2013-10-22 17:48:56,199][INFO][org.elasticsearch.node] [Nocturne]  
initialized  
[2013-10-22 17:48:56,200][INFO][org.elasticsearch.node] [Nocturne]  
starting ...  
[2013-10-22  
17:48:56,207][DEBUG][org.elasticsearch.plugins.myplugin.service] [Nocturne]  
security.configuration.index=securityconfiguration  
[2013-10-22 17:48:56,349][INFO][org.elasticsearch.transport] [Nocturne]  
bound\_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish\_address  
{inet[/1x2.xx.27.6:9300]}  
[2013-10-22 17:48:59,485][INFO][org.elasticsearch.cluster.service]  
[Nocturne] new\_master  
[Nocturne][9Qnq2Bs3QUuFBw\_0-Ompxg][inet[/1x2.xx.27.6:9300]]{http.enabled=true,  
local=false}, reason: zen-disco-join (elected\_as\_master)  
[2013-10-22 17:48:59,541][INFO][org.elasticsearch.discovery] [Nocturne]  
elasticsearch/9Qnq2Bs3QUuFBw\_0-Ompxg  
[2013-10-22 17:48:59,556][INFO][org.elasticsearch.gateway] [Nocturne]  
recovered [0] indices into cluster\_state  
[2013-10-22 17:48:59,587][INFO][org.elasticsearch.http] [Nocturne]  
bound\_address {inet[/0:0:0:0:0:0:0:0:9200]}, publish\_address  
{inet[/1x2.xx.27.6:9200]}  
[2013-10-22 17:48:59,587][INFO][org.elasticsearch.node] [Nocturne]  
started

Node node =  
NodeBuilder.nodeBuilder().local(false).settings(settings).node();  
client = node.client();  
client.prepareIndex("content","mytype").setSource(loadFile("dummy\_content.json")).setRefresh(true).execute().actionGet();  
\<-- this normally invkoes RestFilter, but not within Junit

If i point my browser (during test is running) to localhost:9200 then the  
RestFilter is invoked correctly.

I have also played around with the TransportClient, but situation is the  
same.

Thanks  
Hendrik

--  
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:** ![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:** [October 22, 2013, 4:29pm UTC](https://discuss.elastic.co/t/unittest-restfilter-gets-not-invoked-when-using-internal-client-or-transportclient/14058/2 "2013-10-22T16:29:45Z")

</div>

With Junit you are starting a Node and get a Transport Client from that node.  
That means you are using Transport Layer (9300) and not REST Layer.

That's the reason your REST Filter is not applied here.

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 22 oct. 2013 à 17:56, Hendrik [h.j.saly@googlemail.com](mailto:h.j.saly@googlemail.com) a écrit :

> I have written a RestFilter and i want to add some unit tests to test it.  
> But it seems that the RestFilter gets not invoked from the unittest.
> 
> [2013-10-22 17:48:54,340][INFO][org.elasticsearch.node] [Nocturne] version[0.90.5], pid[9456], build[c8714e8/2013-09-17T12:50:20Z]  
> [2013-10-22 17:48:54,340][INFO][org.elasticsearch.node] [Nocturne] initializing ...  
> [2013-10-22 17:48:54,346][DEBUG][org.elasticsearch.plugins.security] Starting Security Plugin  
> [2013-10-22 17:48:54,351][INFO][org.elasticsearch.plugins] [Nocturne] loaded [elasticsearch-my-plugin], sites   
> [2013-10-22 17:48:56,199][INFO][org.elasticsearch.node] [Nocturne] initialized  
> [2013-10-22 17:48:56,200][INFO][org.elasticsearch.node] [Nocturne] starting ...  
> [2013-10-22 17:48:56,207][DEBUG][org.elasticsearch.plugins.myplugin.service] [Nocturne] security.configuration.index=securityconfiguration  
> [2013-10-22 17:48:56,349][INFO][org.elasticsearch.transport] [Nocturne] bound\_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish\_address {inet[/1x2.xx.27.6:9300]}  
> [2013-10-22 17:48:59,485][INFO][org.elasticsearch.cluster.service] [Nocturne] new\_master [Nocturne][9Qnq2Bs3QUuFBw\_0-Ompxg][inet[/1x2.xx.27.6:9300]]{http.enabled=true, local=false}, reason: zen-disco-join (elected\_as\_master)  
> [2013-10-22 17:48:59,541][INFO][org.elasticsearch.discovery] [Nocturne] elasticsearch/9Qnq2Bs3QUuFBw\_0-Ompxg  
> [2013-10-22 17:48:59,556][INFO][org.elasticsearch.gateway] [Nocturne] recovered [0] indices into cluster\_state  
> [2013-10-22 17:48:59,587][INFO][org.elasticsearch.http] [Nocturne] bound\_address {inet[/0:0:0:0:0:0:0:0:9200]}, publish\_address {inet[/1x2.xx.27.6:9200]}  
> [2013-10-22 17:48:59,587][INFO][org.elasticsearch.node] [Nocturne] started
> 
> Node node = NodeBuilder.nodeBuilder().local(false).settings(settings).node();  
> client = node.client();  
> client.prepareIndex("content","mytype").setSource(loadFile("dummy\_content.json")).setRefresh(true).execute().actionGet(); \<-- this normally invkoes RestFilter, but not within Junit
> 
> If i point my browser (during test is running) to localhost:9200 then the RestFilter is invoked correctly.
> 
> I have also played around with the TransportClient, but situation is the same.
> 
> Thanks  
> Hendrik
> 
> --  
> 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).

--  
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:** ![Hendrik](https://avatars.discourse-cdn.com/v4/letter/h/839c29/32.png) [@Hendrik](https://discuss.elastic.co/u/Hendrik)\
**Post date:** [October 22, 2013, 4:37pm UTC](https://discuss.elastic.co/t/unittest-restfilter-gets-not-invoked-when-using-internal-client-or-transportclient/14058/3 "2013-10-22T16:37:30Z")

</div>

thanks, and how can i use the REST layer from within a unit test?

Am Dienstag, 22. Oktober 2013 18:29:45 UTC+2 schrieb David Pilato:

> With Junit you are starting a Node and get a Transport Client from that  
> node.  
> That means you are using Transport Layer (9300) and not REST Layer.
> 
> That's the reason your REST Filter is not applied here.
> 
> --  
> _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr[https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)  
> | @scrutmydocs [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)
> 
> Le 22 oct. 2013 à 17:56, Hendrik \<[h.j....@googlemail.com](mailto:h.j....@googlemail.com) \<javascript:\>\> a  
> écrit :
> 
> I have written a RestFilter and i want to add some unit tests to test it.  
> But it seems that the RestFilter gets not invoked from the unittest.
> 
> [2013-10-22 17:48:54,340][INFO][org.elasticsearch.node] [Nocturne]  
> version[0.90.5], pid[9456], build[c8714e8/2013-09-17T12:50:20Z]  
> [2013-10-22 17:48:54,340][INFO][org.elasticsearch.node] [Nocturne]  
> initializing ...  
> [2013-10-22 17:48:54,346][DEBUG][org.elasticsearch.plugins.security]  
> Starting Security Plugin  
> [2013-10-22 17:48:54,351][INFO][org.elasticsearch.plugins] [Nocturne]  
> loaded [elasticsearch-my-plugin], sites   
> [2013-10-22 17:48:56,199][INFO][org.elasticsearch.node] [Nocturne]  
> initialized  
> [2013-10-22 17:48:56,200][INFO][org.elasticsearch.node] [Nocturne]  
> starting ...  
> [2013-10-22  
> 17:48:56,207][DEBUG][org.elasticsearch.plugins.myplugin.service] [Nocturne]  
> security.configuration.index=securityconfiguration  
> [2013-10-22 17:48:56,349][INFO][org.elasticsearch.transport] [Nocturne]  
> bound\_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish\_address  
> {inet[/1x2.xx.27.6:9300]}  
> [2013-10-22 17:48:59,485][INFO][org.elasticsearch.cluster.service]  
> [Nocturne] new\_master  
> [Nocturne][9Qnq2Bs3QUuFBw\_0-Ompxg][inet[/1x2.xx.27.6:9300]]{http.enabled=true,  
> local=false}, reason: zen-disco-join (elected\_as\_master)  
> [2013-10-22 17:48:59,541][INFO][org.elasticsearch.discovery] [Nocturne]  
> elasticsearch/9Qnq2Bs3QUuFBw\_0-Ompxg  
> [2013-10-22 17:48:59,556][INFO][org.elasticsearch.gateway] [Nocturne]  
> recovered [0] indices into cluster\_state  
> [2013-10-22 17:48:59,587][INFO][org.elasticsearch.http] [Nocturne]  
> bound\_address {inet[/0:0:0:0:0:0:0:0:9200]}, publish\_address  
> {inet[/1x2.xx.27.6:9200]}  
> [2013-10-22 17:48:59,587][INFO][org.elasticsearch.node] [Nocturne]  
> started
> 
> Node node =  
> NodeBuilder.nodeBuilder().local(false).settings(settings).node();  
> client = node.client();  
> client.prepareIndex("content","mytype").setSource(loadFile("dummy\_content.json")).setRefresh(true).execute().actionGet();  
> \<-- this normally invkoes RestFilter, but not within Junit
> 
> If i point my browser (during test is running) to localhost:9200 then the  
> RestFilter is invoked correctly.
> 
> I have also played around with the TransportClient, but situation is the  
> same.
> 
> Thanks  
> Hendrik
> 
> --  
> 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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:** ![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:** [October 22, 2013, 4:43pm UTC](https://discuss.elastic.co/t/unittest-restfilter-gets-not-invoked-when-using-internal-client-or-transportclient/14058/4 "2013-10-22T16:43:36Z")

</div>

With a REST call! 🙂

I did use in the past RestTemplate: [https://github.com/scrutmydocs/scrutmydocs/blob/master/src/test/java/org/scrutmydocs/webapp/itest/api/AbstractApiTest.java](https://github.com/scrutmydocs/scrutmydocs/blob/master/src/test/java/org/scrutmydocs/webapp/itest/api/AbstractApiTest.java)

I assume that you could do something easier similar to this (not tested):

```
    URL url = new URL( http_url );
    InputStream stream = url.openConnection().getInputStream();

```

And then parse the result?

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 22 oct. 2013 à 18:37, Hendrik [h.j.saly@googlemail.com](mailto:h.j.saly@googlemail.com) a écrit :

> thanks, and how can i use the REST layer from within a unit test?
> 
> Am Dienstag, 22. Oktober 2013 18:29:45 UTC+2 schrieb David Pilato:  
> With Junit you are starting a Node and get a Transport Client from that node.  
> That means you are using Transport Layer (9300) and not REST Layer.
> 
> That's the reason your REST Filter is not applied here.
> 
> --  
> David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
> @dadoonet | @elasticsearchfr | @scrutmydocs
> 
> Le 22 oct. 2013 à 17:56, Hendrik [h.j....@googlemail.com](mailto:h.j....@googlemail.com) a écrit :
> 
> > I have written a RestFilter and i want to add some unit tests to test it.  
> > But it seems that the RestFilter gets not invoked from the unittest.
> > 
> > [2013-10-22 17:48:54,340][INFO][org.elasticsearch.node] [Nocturne] version[0.90.5], pid[9456], build[c8714e8/2013-09-17T12:50:20Z]  
> > [2013-10-22 17:48:54,340][INFO][org.elasticsearch.node] [Nocturne] initializing ...  
> > [2013-10-22 17:48:54,346][DEBUG][org.elasticsearch.plugins.security] Starting Security Plugin  
> > [2013-10-22 17:48:54,351][INFO][org.elasticsearch.plugins] [Nocturne] loaded [elasticsearch-my-plugin], sites   
> > [2013-10-22 17:48:56,199][INFO][org.elasticsearch.node] [Nocturne] initialized  
> > [2013-10-22 17:48:56,200][INFO][org.elasticsearch.node] [Nocturne] starting ...  
> > [2013-10-22 17:48:56,207][DEBUG][org.elasticsearch.plugins.myplugin.service] [Nocturne] security.configuration.index=securityconfiguration  
> > [2013-10-22 17:48:56,349][INFO][org.elasticsearch.transport] [Nocturne] bound\_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish\_address {inet[/1x2.xx.27.6:9300]}  
> > [2013-10-22 17:48:59,485][INFO][org.elasticsearch.cluster.service] [Nocturne] new\_master [Nocturne][9Qnq2Bs3QUuFBw\_0-Ompxg][inet[/1x2.xx.27.6:9300]]{http.enabled=true, local=false}, reason: zen-disco-join (elected\_as\_master)  
> > [2013-10-22 17:48:59,541][INFO][org.elasticsearch.discovery] [Nocturne] elasticsearch/9Qnq2Bs3QUuFBw\_0-Ompxg  
> > [2013-10-22 17:48:59,556][INFO][org.elasticsearch.gateway] [Nocturne] recovered [0] indices into cluster\_state  
> > [2013-10-22 17:48:59,587][INFO][org.elasticsearch.http] [Nocturne] bound\_address {inet[/0:0:0:0:0:0:0:0:9200]}, publish\_address {inet[/1x2.xx.27.6:9200]}  
> > [2013-10-22 17:48:59,587][INFO][org.elasticsearch.node] [Nocturne] started
> > 
> > Node node = NodeBuilder.nodeBuilder().local(false).settings(settings).node();  
> > client = node.client();  
> > client.prepareIndex("content","mytype").setSource(loadFile("dummy\_content.json")).setRefresh(true).execute().actionGet(); \<-- this normally invkoes RestFilter, but not within Junit
> > 
> > If i point my browser (during test is running) to localhost:9200 then the RestFilter is invoked correctly.
> > 
> > I have also played around with the TransportClient, but situation is the same.
> > 
> > Thanks  
> > Hendrik
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> 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).

--  
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:** ![Hendrik](https://avatars.discourse-cdn.com/v4/letter/h/839c29/32.png) [@Hendrik](https://discuss.elastic.co/u/Hendrik)\
**Post date:** [October 22, 2013, 4:54pm UTC](https://discuss.elastic.co/t/unittest-restfilter-gets-not-invoked-when-using-internal-client-or-transportclient/14058/5 "2013-10-22T16:54:37Z")

</div>

ok understood, i think i will use a rest client  
like [GitHub - searchbox-io/Jest: Elasticsearch Java Rest Client.](https://github.com/searchbox-io/Jest)  
thanks

Am Dienstag, 22. Oktober 2013 18:43:36 UTC+2 schrieb David Pilato:

> With a REST call! 🙂
> 
> I did use in the past RestTemplate:  
> [https://github.com/scrutmydocs/scrutmydocs/blob/master/src/test/java/org/scrutmydocs/webapp/itest/api/AbstractApiTest.java](https://github.com/scrutmydocs/scrutmydocs/blob/master/src/test/java/org/scrutmydocs/webapp/itest/api/AbstractApiTest.java)
> 
> I assume that you could do something easier similar to this (not tested):
> 
> ```
> URL url = new URL( http_url );
> InputStream stream = url.openConnection().getInputStream();
> 
> ```
> 
> And then parse the result?
> 
> --  
> _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr[https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)  
> | @scrutmydocs [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)
> 
> Le 22 oct. 2013 à 18:37, Hendrik \<[h.j....@googlemail.com](mailto:h.j....@googlemail.com) \<javascript:\>\> a  
> écrit :
> 
> thanks, and how can i use the REST layer from within a unit test?
> 
> Am Dienstag, 22. Oktober 2013 18:29:45 UTC+2 schrieb David Pilato:
> 
> > With Junit you are starting a Node and get a Transport Client from that  
> > node.  
> > That means you are using Transport Layer (9300) and not REST Layer.
> > 
> > That's the reason your REST Filter is not applied here.
> > 
> > --  
> > _David Pilato_ | _Technical Advocate_ | \*[Elasticsearch.com](http://Elasticsearch.com)[http://elasticsearch.com/](http://elasticsearch.com/)  
> > \*  
> > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr[https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)  
> > | @scrutmydocs [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)
> > 
> > Le 22 oct. 2013 à 17:56, Hendrik [h.j....@googlemail.com](mailto:h.j....@googlemail.com) a écrit :
> > 
> > I have written a RestFilter and i want to add some unit tests to test it.  
> > But it seems that the RestFilter gets not invoked from the unittest.
> > 
> > [2013-10-22 17:48:54,340][INFO][org.elasticsearch.node] [Nocturne]  
> > version[0.90.5], pid[9456], build[c8714e8/2013-09-17T12:50:20Z]  
> > [2013-10-22 17:48:54,340][INFO][org.elasticsearch.node] [Nocturne]  
> > initializing ...  
> > [2013-10-22 17:48:54,346][DEBUG][org.elasticsearch.plugins.security]  
> > Starting Security Plugin  
> > [2013-10-22 17:48:54,351][INFO][org.elasticsearch.plugins] [Nocturne]  
> > loaded [elasticsearch-my-plugin], sites   
> > [2013-10-22 17:48:56,199][INFO][org.elasticsearch.node] [Nocturne]  
> > initialized  
> > [2013-10-22 17:48:56,200][INFO][org.elasticsearch.node] [Nocturne]  
> > starting ...  
> > [2013-10-22  
> > 17:48:56,207][DEBUG][org.elasticsearch.plugins.myplugin.service] [Nocturne]  
> > security.configuration.index=securityconfiguration  
> > [2013-10-22 17:48:56,349][INFO][org.elasticsearch.transport] [Nocturne]  
> > bound\_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish\_address  
> > {inet[/1x2.xx.27.6:9300]}  
> > [2013-10-22 17:48:59,485][INFO][org.elasticsearch.cluster.service]  
> > [Nocturne] new\_master  
> > [Nocturne][9Qnq2Bs3QUuFBw\_0-Ompxg][inet[/1x2.xx.27.6:9300]]{http.enabled=true,  
> > local=false}, reason: zen-disco-join (elected\_as\_master)  
> > [2013-10-22 17:48:59,541][INFO][org.elasticsearch.discovery] [Nocturne]  
> > elasticsearch/9Qnq2Bs3QUuFBw\_0-Ompxg  
> > [2013-10-22 17:48:59,556][INFO][org.elasticsearch.gateway] [Nocturne]  
> > recovered [0] indices into cluster\_state  
> > [2013-10-22 17:48:59,587][INFO][org.elasticsearch.http] [Nocturne]  
> > bound\_address {inet[/0:0:0:0:0:0:0:0:9200]}, publish\_address  
> > {inet[/1x2.xx.27.6:9200]}  
> > [2013-10-22 17:48:59,587][INFO][org.elasticsearch.node] [Nocturne]  
> > started
> > 
> > Node node =  
> > NodeBuilder.nodeBuilder().local(false).settings(settings).node();  
> > client = node.client();  
> > client.prepareIndex("content","mytype").setSource(loadFile("dummy\_content.json")).setRefresh(true).execute().actionGet();  
> > \<-- this normally invkoes RestFilter, but not within Junit
> > 
> > If i point my browser (during test is running) to localhost:9200 then the  
> > RestFilter is invoked correctly.
> > 
> > I have also played around with the TransportClient, but situation is the  
> > same.
> > 
> > Thanks  
> > Hendrik
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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:11am UTC](https://discuss.elastic.co/t/unittest-restfilter-gets-not-invoked-when-using-internal-client-or-transportclient/14058/6 "2017-07-06T02:11:09Z")

</div>

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


