# Plugin call returns "No handler found for uri"

**URL:** <https://discuss.elastic.co/t/plugin-call-returns-no-handler-found-for-uri/14289>\
**Category:** Elasticsearch\
**Created:** [November 6, 2013, 2:57pm UTC](https://discuss.elastic.co/t/plugin-call-returns-no-handler-found-for-uri/14289 "2013-11-06T14:57:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luiz\_Henrique\_Zambom](https://avatars.discourse-cdn.com/v4/letter/l/9e8a1a/32.png) [@Luiz\_Henrique\_Zambom](https://discuss.elastic.co/u/Luiz_Henrique_Zambom)\
**Post date:** [November 6, 2013, 2:57pm UTC](https://discuss.elastic.co/t/plugin-call-returns-no-handler-found-for-uri/14289/1 "2013-11-06T14:57:53Z")

</div>

Hello:

I am trying to develop a simple plugin to count terms in a repository using  
Lucene and expose the result through a elastic search RestHandler.

I successfully went through these plugins tutorial:

> **[Writing an Elasticsearch Plugin: Getting Started
	  	 | Elastic](https://www.elastic.co/blog/found-writing-a-plugin)**
>
> Using plugins, it's possible to add new functionality to Elasticsearch without having to create a fork of Elasticsearch itself. In this article, we will go through the steps required to create a new Elasticsearch plugin from the ground up.

  
[http://elasticsearchserverbook.com/creating-custom-elasticsearch-rest-action/](http://elasticsearchserverbook.com/creating-custom-elasticsearch-rest-action/)

And I can see that my plugin is installed and loaded.

[2013-11-06 14:47:00,471][INFO  
][org.elasticsearch.plugin.wordfrequencyplugin.WordFrequencyPlugin]  
WordFrequencyPlugin settings  
[2013-11-06 14:47:00,472][INFO  
][org.elasticsearch.plugin.wordfrequencyplugin.WordFrequencyPlugin] name  
[2013-11-06 14:47:00,475][INFO][plugins] [Starbolt]  
loaded [WordFrequencyPlugin], sites []  
[2013-11-06 14:47:00,554][INFO  
][org.elasticsearch.plugin.wordfrequencyplugin.WordFrequencyPlugin] onModule  
[2013-11-06 14:47:02,200][INFO  
][org.elasticsearch.plugin.wordfrequencyplugin.CustomRestRegisterAction]  
Registering action /\_counter/movies

However, when I try:

lsantana@abc:~/elasticsearch-0.90.6/bin$ curl -XGET  
'localhost:9200/\_counter/movies?term=XPTO'  
No handler found for uri [/\_counter/movies?term=XPTO] and method  
[GET]lsantana@iqserdev10:~/elasticsearch-0.90.6/bin$

My BaseRestHandler looks like this:

public class CustomRestRegisterAction extends BaseRestHandler {

private static Logger log =  
Logger.getLogger(CustomRestRegisterAction.class);  
public CustomRestRegisterAction(Settings settings, Client client) {  
super(settings, client);  
}  
@Inject  
public CustomRestRegisterAction(Settings settings, Client client,  
RestController controller) {  
super(settings, client);  
String path = "/\_counter/movies";  
controller.registerHandler(Method.GET, path, new  
CustomRestRegisterAction(settings, client));  
log.info("Registering action "+path);  
}

public void handleRequest(RestRequest request, RestChannel channel) {

log.info("Handling request");  
String term = request.param("term");

Lucene l = new Lucene();  
int frequency = -1;  
try {

DirectoryReader directoryReader = new DirectoryReader();  
Directory directory = directoryReader.getDocuments();

frequency = l.frequency(term, "city", directory);  
} catch (IOException e) {  
e.printStackTrace();  
}

channel.sendResponse(new StringRestResponse(RestStatus.OK, String  
.valueOf(frequency)));  
}  
}

Any clue about what can be missing?

Best regards,

Luiz

--  
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:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [November 6, 2013, 9:56pm UTC](https://discuss.elastic.co/t/plugin-call-returns-no-handler-found-for-uri/14289/2 "2013-11-06T21:56:31Z")

</div>

Did you register your action with the RestModule?

Take a look at Jorg's plugin, which might be similar to yours:

> **[GitHub - jprante/elasticsearch-index-termlist: Elasticsearch Index Termlist](https://github.com/jprante/elasticsearch-index-termlist)**
>
> Elasticsearch Index Termlist. Contribute to jprante/elasticsearch-index-termlist development by creating an account on GitHub.

In his plugin defintion, he adds various actions to various modules:

```
public void onModule(RestModule module) {
    module.addRestAction(RestTermlistAction.class);
}

```

[https://github.com/jprante/elasticsearch-index-termlist/blob/master/src/main/java/org/xbib/elasticsearch/plugin/termlist/IndexTermlistPlugin.java](https://github.com/jprante/elasticsearch-index-termlist/blob/master/src/main/java/org/xbib/elasticsearch/plugin/termlist/IndexTermlistPlugin.java)

Cheers,

Ivan

On Wed, Nov 6, 2013 at 6:57 AM, Luiz Henrique Zambom Santana \<  
[lhzsantana@gmail.com](mailto:lhzsantana@gmail.com)\> wrote:

> Hello:
> 
> I am trying to develop a simple plugin to count terms in a repository  
> using Lucene and expose the result through a Elasticsearch RestHandler.
> 
> I successfully went through these plugins tutorial:
> 
> [Writing an Elasticsearch Plugin: Getting Started | Elastic Blog](http://www.found.no/foundation/writing-a-plugin/)
> 
> [http://elasticsearchserverbook.com/creating-custom-elasticsearch-rest-action/](http://elasticsearchserverbook.com/creating-custom-elasticsearch-rest-action/)
> 
> And I can see that my plugin is installed and loaded.
> 
> [2013-11-06 14:47:00,471][INFO  
> ][org.elasticsearch.plugin.wordfrequencyplugin.WordFrequencyPlugin]  
> WordFrequencyPlugin settings  
> [2013-11-06 14:47:00,472][INFO  
> ][org.elasticsearch.plugin.wordfrequencyplugin.WordFrequencyPlugin] name  
> [2013-11-06 14:47:00,475][INFO][plugins] [Starbolt]  
> loaded [WordFrequencyPlugin], sites   
> [2013-11-06 14:47:00,554][INFO  
> ][org.elasticsearch.plugin.wordfrequencyplugin.WordFrequencyPlugin] onModule  
> [2013-11-06 14:47:02,200][INFO  
> ][org.elasticsearch.plugin.wordfrequencyplugin.CustomRestRegisterAction]  
> Registering action /\_counter/movies
> 
> However, when I try:
> 
> lsantana@abc:~/elasticsearch-0.90.6/bin$ curl -XGET  
> 'localhost:9200/\_counter/movies?term=XPTO'  
> No handler found for uri [/\_counter/movies?term=XPTO] and method  
> [GET]lsantana@iqserdev10:~/elasticsearch-0.90.6/bin$
> 
> My BaseRestHandler looks like this:
> 
> public class CustomRestRegisterAction extends BaseRestHandler {
> 
> private static Logger log =  
> Logger.getLogger(CustomRestRegisterAction.class);  
> public CustomRestRegisterAction(Settings settings, Client client) {  
> super(settings, client);  
> }  
> @Inject  
> public CustomRestRegisterAction(Settings settings, Client client,  
> RestController controller) {  
> super(settings, client);  
> String path = "/\_counter/movies";  
> controller.registerHandler(Method.GET, path, new  
> CustomRestRegisterAction(settings, client));  
> log.info("Registering action "+path);  
> }
> 
> public void handleRequest(RestRequest request, RestChannel channel) {
> 
> log.info("Handling request");  
> String term = request.param("term");
> 
> Lucene l = new Lucene();  
> int frequency = -1;  
> try {
> 
> DirectoryReader directoryReader = new DirectoryReader();  
> Directory directory = directoryReader.getDocuments();
> 
> frequency = l.frequency(term, "city", directory);  
> } catch (IOException e) {  
> e.printStackTrace();  
> }
> 
> channel.sendResponse(new StringRestResponse(RestStatus.OK, String  
> .valueOf(frequency)));  
> }  
> }
> 
> Any clue about what can be missing?
> 
> Best regards,
> 
> Luiz
> 
> --  
> 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:** ![Luiz\_Henrique\_Zambom](https://avatars.discourse-cdn.com/v4/letter/l/9e8a1a/32.png) [@Luiz\_Henrique\_Zambom](https://discuss.elastic.co/u/Luiz_Henrique_Zambom)\
**Post date:** [November 7, 2013, 9:35am UTC](https://discuss.elastic.co/t/plugin-call-returns-no-handler-found-for-uri/14289/3 "2013-11-07T09:35:31Z")

</div>

Hi Ivan:

Yes, I did. My plugin class is like this:

public class WordFrequencyPlugin extends AbstractPlugin {

private static Logger log = Logger.getLogger(WordFrequencyPlugin.class);

@Inject  
public WordFrequencyPlugin(Settings settings) {  
log.info("WordFrequencyPlugin settings");  
}

@Inject  
public WordFrequencyPlugin() {  
}

public String description() {  
return "Word frequency counter";  
}

public String name() {  
return "WordFrequencyPlugin";  
}

public void onModule(RestModule module) {  
module.addRestAction(CustomRestRegisterAction.class);  
log.info("onModule");  
}  
}

I can see that the onModule method is called and that the handler is  
registered (the method "CustomRestRegisterAction" is called). In the Jorg's  
plugin I see that he register also an action registerAction (below), that I  
do not know if it is necessary to my plugin.

```
public void onModule(ActionModule module) {
    module.registerAction(TermlistAction.INSTANCE,

```

TransportTermlistAction.class);  
}

Can it be what is missing?

Thanks a lot!

2013/11/6 Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com)

> Did you register your action with the RestModule?
> 
> Take a look at Jorg's plugin, which might be similar to yours:
> 
> [GitHub - jprante/elasticsearch-index-termlist: Elasticsearch Index Termlist](https://github.com/jprante/elasticsearch-index-termlist)
> 
> In his plugin defintion, he adds various actions to various modules:
> 
> ```
> public void onModule(RestModule module) {
> module.addRestAction(RestTermlistAction.class);
> }
> 
> ```
> 
> [https://github.com/jprante/elasticsearch-index-termlist/blob/master/src/main/java/org/xbib/elasticsearch/plugin/termlist/IndexTermlistPlugin.java](https://github.com/jprante/elasticsearch-index-termlist/blob/master/src/main/java/org/xbib/elasticsearch/plugin/termlist/IndexTermlistPlugin.java)
> 
> Cheers,
> 
> Ivan
> 
> On Wed, Nov 6, 2013 at 6:57 AM, Luiz Henrique Zambom Santana \<  
> [lhzsantana@gmail.com](mailto:lhzsantana@gmail.com)\> wrote:
> 
> > Hello:
> > 
> > I am trying to develop a simple plugin to count terms in a repository  
> > using Lucene and expose the result through a Elasticsearch RestHandler.
> > 
> > I successfully went through these plugins tutorial:
> > 
> > [Writing an Elasticsearch Plugin: Getting Started | Elastic Blog](http://www.found.no/foundation/writing-a-plugin/)
> > 
> > [http://elasticsearchserverbook.com/creating-custom-elasticsearch-rest-action/](http://elasticsearchserverbook.com/creating-custom-elasticsearch-rest-action/)
> > 
> > And I can see that my plugin is installed and loaded.
> > 
> > [2013-11-06 14:47:00,471][INFO  
> > ][org.elasticsearch.plugin.wordfrequencyplugin.WordFrequencyPlugin]  
> > WordFrequencyPlugin settings  
> > [2013-11-06 14:47:00,472][INFO  
> > ][org.elasticsearch.plugin.wordfrequencyplugin.WordFrequencyPlugin] name  
> > [2013-11-06 14:47:00,475][INFO][plugins] [Starbolt]  
> > loaded [WordFrequencyPlugin], sites   
> > [2013-11-06 14:47:00,554][INFO  
> > ][org.elasticsearch.plugin.wordfrequencyplugin.WordFrequencyPlugin] onModule  
> > [2013-11-06 14:47:02,200][INFO  
> > ][org.elasticsearch.plugin.wordfrequencyplugin.CustomRestRegisterAction]  
> > Registering action /\_counter/movies
> > 
> > However, when I try:
> > 
> > lsantana@abc:~/elasticsearch-0.90.6/bin$ curl -XGET  
> > 'localhost:9200/\_counter/movies?term=XPTO'  
> > No handler found for uri [/\_counter/movies?term=XPTO] and method  
> > [GET]lsantana@iqserdev10:~/elasticsearch-0.90.6/bin$
> > 
> > My BaseRestHandler looks like this:
> > 
> > public class CustomRestRegisterAction extends BaseRestHandler {
> > 
> > private static Logger log =  
> > Logger.getLogger(CustomRestRegisterAction.class);  
> > public CustomRestRegisterAction(Settings settings, Client client) {  
> > super(settings, client);  
> > }  
> > @Inject  
> > public CustomRestRegisterAction(Settings settings, Client client,  
> > RestController controller) {  
> > super(settings, client);  
> > String path = "/\_counter/movies";  
> > controller.registerHandler(Method.GET, path, new  
> > CustomRestRegisterAction(settings, client));  
> > log.info("Registering action "+path);  
> > }
> > 
> > public void handleRequest(RestRequest request, RestChannel channel) {
> > 
> > log.info("Handling request");  
> > String term = request.param("term");
> > 
> > Lucene l = new Lucene();  
> > int frequency = -1;  
> > try {
> > 
> > DirectoryReader directoryReader = new DirectoryReader();  
> > Directory directory = directoryReader.getDocuments();
> > 
> > frequency = l.frequency(term, "city", directory);  
> > } catch (IOException e) {  
> > e.printStackTrace();  
> > }
> > 
> > channel.sendResponse(new StringRestResponse(RestStatus.OK, String  
> > .valueOf(frequency)));  
> > }  
> > }
> > 
> > Any clue about what can be missing?
> > 
> > Best regards,
> > 
> > Luiz
> > 
> > --  
> > 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 a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/Go7dXZAX5SA/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Go7dXZAX5SA/unsubscribe).  
> To unsubscribe from this group and all its topics, 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).

--  
Um abraço,

Luiz Henrique Zambom Santana

--  
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:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [November 7, 2013, 6:58pm UTC](https://discuss.elastic.co/t/plugin-call-returns-no-handler-found-for-uri/14289/4 "2013-11-07T18:58:17Z")

</div>

The custom action is not required for your REST endpoint to run, but it  
ultimately will be required for proper results. Currently only the node  
receiving the request will handle the request. If you want ever node to  
participate in counting terms, you must send an action via the Client.

As far as your REST endpoint not working, I cannot spot the problem. Are  
you running on a multi-node cluster? Does every node have the plugin? Try  
removing the superfluous CustomRestRegisterAction constructor. You do not  
need to, it just bugs me. 🙂

Cheers,

Ivan

On Thu, Nov 7, 2013 at 1:35 AM, [lhzsantana@gmail.com](mailto:lhzsantana@gmail.com)  
[lhzsantana@gmail.com](mailto:lhzsantana@gmail.com)wrote:

> Hi Ivan:
> 
> Yes, I did. My plugin class is like this:
> 
> public class WordFrequencyPlugin extends AbstractPlugin {
> 
> private static Logger log = Logger.getLogger(WordFrequencyPlugin.class);
> 
> @Inject  
> public WordFrequencyPlugin(Settings settings) {  
> log.info("WordFrequencyPlugin settings");  
> }
> 
> @Inject  
> public WordFrequencyPlugin() {  
> }
> 
> public String description() {  
> return "Word frequency counter";  
> }
> 
> public String name() {  
> return "WordFrequencyPlugin";  
> }
> 
> public void onModule(RestModule module) {  
> module.addRestAction(CustomRestRegisterAction.class);  
> log.info("onModule");  
> }  
> }
> 
> I can see that the onModule method is called and that the handler is  
> registered (the method "CustomRestRegisterAction" is called). In the Jorg's  
> plugin I see that he register also an action registerAction (below), that  
> I do not know if it is necessary to my plugin.
> 
> ```
> public void onModule(ActionModule module) {
> module.registerAction(TermlistAction.INSTANCE, TransportTermlistAction.class);
> }
> 
> ```
> 
> Can it be what is missing?
> 
> Thanks a lot!
> 
> 2013/11/6 Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com)
> 
> > Did you register your action with the RestModule?
> > 
> > Take a look at Jorg's plugin, which might be similar to yours:
> > 
> > [GitHub - jprante/elasticsearch-index-termlist: Elasticsearch Index Termlist](https://github.com/jprante/elasticsearch-index-termlist)
> > 
> > In his plugin defintion, he adds various actions to various modules:
> > 
> > ```
> > public void onModule(RestModule module) {
> > 
> > module.addRestAction(RestTermlistAction.class);
> > 
> > }
> > 
> > ```
> > 
> > [https://github.com/jprante/elasticsearch-index-termlist/blob/master/src/main/java/org/xbib/elasticsearch/plugin/termlist/IndexTermlistPlugin.java](https://github.com/jprante/elasticsearch-index-termlist/blob/master/src/main/java/org/xbib/elasticsearch/plugin/termlist/IndexTermlistPlugin.java)
> > 
> > Cheers,
> > 
> > Ivan
> > 
> > On Wed, Nov 6, 2013 at 6:57 AM, Luiz Henrique Zambom Santana \<  
> > [lhzsantana@gmail.com](mailto:lhzsantana@gmail.com)\> wrote:
> > 
> > > Hello:
> > > 
> > > I am trying to develop a simple plugin to count terms in a repository  
> > > using Lucene and expose the result through a Elasticsearch RestHandler.
> > > 
> > > I successfully went through these plugins tutorial:
> > > 
> > > [Writing an Elasticsearch Plugin: Getting Started | Elastic Blog](http://www.found.no/foundation/writing-a-plugin/)
> > > 
> > > [http://elasticsearchserverbook.com/creating-custom-elasticsearch-rest-action/](http://elasticsearchserverbook.com/creating-custom-elasticsearch-rest-action/)
> > > 
> > > And I can see that my plugin is installed and loaded.
> > > 
> > > [2013-11-06 14:47:00,471][INFO  
> > > ][org.elasticsearch.plugin.wordfrequencyplugin.WordFrequencyPlugin]  
> > > WordFrequencyPlugin settings  
> > > [2013-11-06 14:47:00,472][INFO  
> > > ][org.elasticsearch.plugin.wordfrequencyplugin.WordFrequencyPlugin] name  
> > > [2013-11-06 14:47:00,475][INFO][plugins] [Starbolt]  
> > > loaded [WordFrequencyPlugin], sites   
> > > [2013-11-06 14:47:00,554][INFO  
> > > ][org.elasticsearch.plugin.wordfrequencyplugin.WordFrequencyPlugin] onModule  
> > > [2013-11-06 14:47:02,200][INFO  
> > > ][org.elasticsearch.plugin.wordfrequencyplugin.CustomRestRegisterAction]  
> > > Registering action /\_counter/movies
> > > 
> > > However, when I try:
> > > 
> > > lsantana@abc:~/elasticsearch-0.90.6/bin$ curl -XGET  
> > > 'localhost:9200/\_counter/movies?term=XPTO'  
> > > No handler found for uri [/\_counter/movies?term=XPTO] and method  
> > > [GET]lsantana@iqserdev10:~/elasticsearch-0.90.6/bin$
> > > 
> > > My BaseRestHandler looks like this:
> > > 
> > > public class CustomRestRegisterAction extends BaseRestHandler {
> > > 
> > > private static Logger log =  
> > > Logger.getLogger(CustomRestRegisterAction.class);  
> > > public CustomRestRegisterAction(Settings settings, Client client) {  
> > > super(settings, client);  
> > > }  
> > > @Inject  
> > > public CustomRestRegisterAction(Settings settings, Client client,  
> > > RestController controller) {  
> > > super(settings, client);  
> > > String path = "/\_counter/movies";  
> > > controller.registerHandler(Method.GET, path, new  
> > > CustomRestRegisterAction(settings, client));  
> > > log.info("Registering action "+path);  
> > > }
> > > 
> > > public void handleRequest(RestRequest request, RestChannel channel) {
> > > 
> > > log.info("Handling request");  
> > > String term = request.param("term");
> > > 
> > > Lucene l = new Lucene();  
> > > int frequency = -1;  
> > > try {
> > > 
> > > DirectoryReader directoryReader = new DirectoryReader();  
> > > Directory directory = directoryReader.getDocuments();
> > > 
> > > frequency = l.frequency(term, "city", directory);  
> > > } catch (IOException e) {  
> > > e.printStackTrace();  
> > > }
> > > 
> > > channel.sendResponse(new StringRestResponse(RestStatus.OK, String  
> > > .valueOf(frequency)));  
> > > }  
> > > }
> > > 
> > > Any clue about what can be missing?
> > > 
> > > Best regards,
> > > 
> > > Luiz
> > > 
> > > --  
> > > 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 a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/Go7dXZAX5SA/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Go7dXZAX5SA/unsubscribe).  
> > To unsubscribe from this group and all its topics, 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).
> 
> --  
> Um abraço,
> 
> Luiz Henrique Zambom Santana
> 
> --  
> 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:** ![Luiz\_Henrique\_Zambom](https://avatars.discourse-cdn.com/v4/letter/l/9e8a1a/32.png) [@Luiz\_Henrique\_Zambom](https://discuss.elastic.co/u/Luiz_Henrique_Zambom)\
**Post date:** [November 8, 2013, 3:21pm UTC](https://discuss.elastic.co/t/plugin-call-returns-no-handler-found-for-uri/14289/5 "2013-11-08T15:21:47Z")

</div>

Hi Ivan:

Thank you a lot for the help.

I started it over again, went to all the steps and now it is working =).

Thanks again!

Luiz

2013/11/7 Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com)

> The custom action is not required for your REST endpoint to run, but it  
> ultimately will be required for proper results. Currently only the node  
> receiving the request will handle the request. If you want ever node to  
> participate in counting terms, you must send an action via the Client.
> 
> As far as your REST endpoint not working, I cannot spot the problem. Are  
> you running on a multi-node cluster? Does every node have the plugin? Try  
> removing the superfluous CustomRestRegisterAction constructor. You do not  
> need to, it just bugs me. 🙂
> 
> Cheers,
> 
> Ivan
> 
> On Thu, Nov 7, 2013 at 1:35 AM, [lhzsantana@gmail.com](mailto:lhzsantana@gmail.com) \<[lhzsantana@gmail.com](mailto:lhzsantana@gmail.com)
> 
> > wrote:
> 
> > Hi Ivan:
> > 
> > Yes, I did. My plugin class is like this:
> > 
> > public class WordFrequencyPlugin extends AbstractPlugin {
> > 
> > private static Logger log = Logger.getLogger(WordFrequencyPlugin.class);
> > 
> > @Inject  
> > public WordFrequencyPlugin(Settings settings) {  
> > log.info("WordFrequencyPlugin settings");  
> > }
> > 
> > @Inject  
> > public WordFrequencyPlugin() {  
> > }
> > 
> > public String description() {  
> > return "Word frequency counter";  
> > }
> > 
> > public String name() {  
> > return "WordFrequencyPlugin";  
> > }
> > 
> > public void onModule(RestModule module) {  
> > module.addRestAction(CustomRestRegisterAction.class);  
> > log.info("onModule");  
> > }  
> > }
> > 
> > I can see that the onModule method is called and that the handler is  
> > registered (the method "CustomRestRegisterAction" is called). In the Jorg's  
> > plugin I see that he register also an action registerAction (below),  
> > that I do not know if it is necessary to my plugin.
> > 
> > ```
> > public void onModule(ActionModule module) {
> > 
> > module.registerAction(TermlistAction.INSTANCE, TransportTermlistAction.class);
> > 
> > }
> > 
> > ```
> > 
> > Can it be what is missing?
> > 
> > Thanks a lot!
> > 
> > 2013/11/6 Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com)
> > 
> > > Did you register your action with the RestModule?
> > > 
> > > Take a look at Jorg's plugin, which might be similar to yours:
> > > 
> > > [GitHub - jprante/elasticsearch-index-termlist: Elasticsearch Index Termlist](https://github.com/jprante/elasticsearch-index-termlist)
> > > 
> > > In his plugin defintion, he adds various actions to various modules:
> > > 
> > > ```
> > > public void onModule(RestModule module) {
> > > 
> > > module.addRestAction(RestTermlistAction.class);
> > > 
> > > }
> > > 
> > > ```
> > > 
> > > [https://github.com/jprante/elasticsearch-index-termlist/blob/master/src/main/java/org/xbib/elasticsearch/plugin/termlist/IndexTermlistPlugin.java](https://github.com/jprante/elasticsearch-index-termlist/blob/master/src/main/java/org/xbib/elasticsearch/plugin/termlist/IndexTermlistPlugin.java)
> > > 
> > > Cheers,
> > > 
> > > Ivan
> > > 
> > > On Wed, Nov 6, 2013 at 6:57 AM, Luiz Henrique Zambom Santana \<  
> > > [lhzsantana@gmail.com](mailto:lhzsantana@gmail.com)\> wrote:
> > > 
> > > > Hello:
> > > > 
> > > > I am trying to develop a simple plugin to count terms in a repository  
> > > > using Lucene and expose the result through a Elasticsearch RestHandler.
> > > > 
> > > > I successfully went through these plugins tutorial:
> > > > 
> > > > [Writing an Elasticsearch Plugin: Getting Started | Elastic Blog](http://www.found.no/foundation/writing-a-plugin/)
> > > > 
> > > > [http://elasticsearchserverbook.com/creating-custom-elasticsearch-rest-action/](http://elasticsearchserverbook.com/creating-custom-elasticsearch-rest-action/)
> > > > 
> > > > And I can see that my plugin is installed and loaded.
> > > > 
> > > > [2013-11-06 14:47:00,471][INFO  
> > > > ][org.elasticsearch.plugin.wordfrequencyplugin.WordFrequencyPlugin]  
> > > > WordFrequencyPlugin settings  
> > > > [2013-11-06 14:47:00,472][INFO  
> > > > ][org.elasticsearch.plugin.wordfrequencyplugin.WordFrequencyPlugin] name  
> > > > [2013-11-06 14:47:00,475][INFO][plugins] [Starbolt]  
> > > > loaded [WordFrequencyPlugin], sites   
> > > > [2013-11-06 14:47:00,554][INFO  
> > > > ][org.elasticsearch.plugin.wordfrequencyplugin.WordFrequencyPlugin] onModule  
> > > > [2013-11-06 14:47:02,200][INFO  
> > > > ][org.elasticsearch.plugin.wordfrequencyplugin.CustomRestRegisterAction]  
> > > > Registering action /\_counter/movies
> > > > 
> > > > However, when I try:
> > > > 
> > > > lsantana@abc:~/elasticsearch-0.90.6/bin$ curl -XGET  
> > > > 'localhost:9200/\_counter/movies?term=XPTO'  
> > > > No handler found for uri [/\_counter/movies?term=XPTO] and method  
> > > > [GET]lsantana@iqserdev10:~/elasticsearch-0.90.6/bin$
> > > > 
> > > > My BaseRestHandler looks like this:
> > > > 
> > > > public class CustomRestRegisterAction extends BaseRestHandler {
> > > > 
> > > > private static Logger log =  
> > > > Logger.getLogger(CustomRestRegisterAction.class);  
> > > > public CustomRestRegisterAction(Settings settings, Client client) {  
> > > > super(settings, client);  
> > > > }  
> > > > @Inject  
> > > > public CustomRestRegisterAction(Settings settings, Client client,  
> > > > RestController controller) {  
> > > > super(settings, client);  
> > > > String path = "/\_counter/movies";  
> > > > controller.registerHandler(Method.GET, path, new  
> > > > CustomRestRegisterAction(settings, client));  
> > > > log.info("Registering action "+path);  
> > > > }
> > > > 
> > > > public void handleRequest(RestRequest request, RestChannel channel) {
> > > > 
> > > > log.info("Handling request");  
> > > > String term = request.param("term");
> > > > 
> > > > Lucene l = new Lucene();  
> > > > int frequency = -1;  
> > > > try {
> > > > 
> > > > DirectoryReader directoryReader = new DirectoryReader();  
> > > > Directory directory = directoryReader.getDocuments();
> > > > 
> > > > frequency = l.frequency(term, "city", directory);  
> > > > } catch (IOException e) {  
> > > > e.printStackTrace();  
> > > > }
> > > > 
> > > > channel.sendResponse(new StringRestResponse(RestStatus.OK, String  
> > > > .valueOf(frequency)));  
> > > > }  
> > > > }
> > > > 
> > > > Any clue about what can be missing?
> > > > 
> > > > Best regards,
> > > > 
> > > > Luiz
> > > > 
> > > > --  
> > > > 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 a topic in the  
> > > Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit  
> > > [https://groups.google.com/d/topic/elasticsearch/Go7dXZAX5SA/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Go7dXZAX5SA/unsubscribe).  
> > > To unsubscribe from this group and all its topics, 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).
> > 
> > --  
> > Um abraço,
> > 
> > Luiz Henrique Zambom Santana
> > 
> > --  
> > 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 a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/Go7dXZAX5SA/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Go7dXZAX5SA/unsubscribe).  
> To unsubscribe from this group and all its topics, 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).

--  
Um abraço,

Luiz Henrique Zambom Santana

--  
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:08am UTC](https://discuss.elastic.co/t/plugin-call-returns-no-handler-found-for-uri/14289/6 "2017-07-06T02:08:08Z")

</div>


