[ 
https://issues.apache.org/jira/browse/CONNECTORS-642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13595308#comment-13595308
 ] 

Karl Wright commented on CONNECTORS-642:
----------------------------------------

Here are my detailed notes.

ES uses dependency injection using google guice.  You have 3 building blocks:
  1. Plugin
  2. Module
  3. Service
Example:  https://github.com/spinscale/elasticsearch-suggest-plugin .  In the 
example there is a plugin: 
https://github.com/spinscale/elasticsearch-suggest-plugin/blob/master/src/main/java/org/elasticsearch/plugin/suggest/SuggestPlugin.java
 .  In there you can specify methods like this:

{code}
  public void onModule(RestModule restModule) {
restModule.addRestAction(RestSuggestAction.class);
restModule.addRestAction(RestRefreshSuggestAction.class);
}
{code}

If ES loads the RestModule it calls your onModule, then you can hook in your 
RestAction for query modification.  For query arguments, such as authenticated 
user name, you can just look at what the SearchRestAction does and delegate.  
For example: 
https://github.com/spinscale/elasticsearch-suggest-plugin/blob/master/src/main/java/org/elasticsearch/rest/action/suggest/RestSuggestAction.java
 .  So the Plugin is there to hook into the loading process and make sure you 
publish your "extensions".  The modules take care of anything else.

In our case we can just do a rest action and use the client you get injected in 
the Constructor, perhaps providing somewhat different REST methods that just 
called back to the originals.  We get a Client object that has the full ES api. 
 We can build all queries for instance, or we can just parse the incoming query 
and then modify and wrap in another query.  For reference look at 
org.elasticsearch.rest.action.search.RestSearchAction.

ES won't let you hook into the request execution.  It lets you put in you own 
endpoints but from there on you can do everything.  Nothing is really hidden.  
To try it you just copy the jar into esinstalldir/plugins and restart.  No 
config etc.
                
> Need an ElasticSearch plugin for enforcing ManifoldCF security
> --------------------------------------------------------------
>
>                 Key: CONNECTORS-642
>                 URL: https://issues.apache.org/jira/browse/CONNECTORS-642
>             Project: ManifoldCF
>          Issue Type: New Feature
>          Components: Elastic Search connector
>    Affects Versions: ManifoldCF 1.1
>            Reporter: Karl Wright
>            Assignee: Karl Wright
>             Fix For: ManifoldCF 1.2
>
>
> ElasticSearch is becoming popular and we need to support it fully.  In order 
> for that to happen, we really need an ElasticSearch ManifoldCF plugin.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to