Custom plugin and Elasticsearch client using Java Api


(Daniel Pupo Ricardo) #1

Hi!!
I'm creating a custom plugin to monitorize docs indexed and deleted in elasticsearch indexes. In the plugin I'm using custom settings and a HttpRestClient to do the searchs and other stuff. The question here is, in the plugin settings I set the parameters to connect the client with the cluster, but the plugin is already running in a elasticsearch cluster, so I wanna skip this configurations, is there any via I can intialize the client or access to the parameters needed to intialize the client that I can access from elasticsearch and don't need to set in the plugin configuartion?
Any ideas?


(Ryan Ernst) #2

It depends on which plugin APIs you are extending, but some have access to a NodeClient which you can use to make requests to the cluster.


(Daniel Pupo Ricardo) #3

Ok, I relative new to Elasticsearch, I searched and found, for example, that the rest api has access to the node client but my plugin not register new endpoints, so, what is the most basic api I should extends mi plugin? Besides, with the node client I can access to the indexes stats?

Thanks for the reply!!


(Ryan Ernst) #4

The handleRequest method of RestHandler has the node client as an argument, so if you are adding your own rest apis, it should already be available to you.


(system) #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.