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:
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.
For more options, visit https://groups.google.com/groups/opt_out.