Skip to content

Instantly share code, notes, and snippets.

@jprante
Created September 7, 2012 10:27
Show Gist options
  • Save jprante/3664968 to your computer and use it in GitHub Desktop.
Save jprante/3664968 to your computer and use it in GitHub Desktop.
accessing node stats
package myPluginPackage;
import org.elasticsearch.common.component.AbstractComponent;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.node.service.NodeService;
import org.elasticsearch.action.admin.cluster.node.stats.NodeStats;
public class MyClassInAPlugin extends AbstractComponent {
private final NodeService nodeService;
@Inject
public MyClassInAPlugin(Settings settings, NodeService nodeService) {
super(settings);
this.nodeService = nodeService;
}
public void myMethod() {
NodeStats nodeStats = nodeService.stats();
...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment