Description
caveats:
- The class should be annotated with org.apache.solr.api.EndPoint. Which means only V2 APIs are supported
- The path should have prefix /api/plugin
add a plugin
curl -X POST -H 'Content-type:application/json' --data-binary ' { "add": { "name":"myplugin", "class": "full.ClassName", "path-prefix" : "some-path-prefix" } }' http://localhost:8983/api/cluster/plugins
add a plugin from a package
curl -X POST -H 'Content-type:application/json' --data-binary ' { "add": { "name":"myplugin", "class": "pkgName:full.ClassName" , "path-prefix" : "some-path-prefix" , "version: "1.0" } }' http://localhost:8983/api/cluster/plugins
remove a plugin
curl -X POST -H 'Content-type:application/json' --data-binary ' { "remove": "myplugin" }' http://localhost:8983/api/cluster/plugins
The configuration will be stored in the clusterprops.json
as
{ "plugins" : { "myplugin" : {"class": "full.ClassName", "path-prefix" : "some-path-prefix" } } }
example plugin
public class MyPlugin { private final CoreContainer coreContainer; public MyPlugin(CoreContainer coreContainer) { this.coreContainer = coreContainer; } @EndPoint(path = "/$path-prefix/path1", method = METHOD.GET, permission = READ) public void call(SolrQueryRequest req, SolrQueryResponse rsp){ rsp.add("myplugin.version", "2.0"); } }
This plugin will be accessible on all nodes at /api/some-path-prefix/path1. It's possible to add more methods at different paths. Ensure that all paths start with $path-prefix because that is the prefix in which the plugin is registered with. So /some-path-prefix/path2 , /some-path-prefix/my/deeply/nested/path are all valid paths.
It's possible that the user chooses to register the plugin with a different name. In that case , use a template variable as follows in paths /cluster/some/other/path
Attachments
Attachments
Issue Links
- duplicates
-
SOLR-11099 Provide a mechanism to add non-core level handlers
- Closed
-
SOLR-13553 Node level custom RequestHandlers
- Closed
- is blocked by
-
SOLR-14598 Security Manager causing reflection exceptions
- Closed
- is related to
-
SOLR-15782 Configure custom node/container handlers in solr.xml
- Open
- links to