Thread Pool Information Using Java API


(Ed Brown) #1

Good morning,
I'm trying to get the same information using the Java API that I can get using the curl command, "curl localhost:9200/_cat/threadpool".

I'm using the TransportClient API to get the client connection to ElasticSearch.

When I use client.admin().cluster().threadpool(), and iterate over stats(), the only thread pool name that is populated with information is "generic", even though the curl command shows otherwise.

What is the correct API I should be using?

Thank you.

Ed Brown
Software Architect


(Adrien Grand) #2

You need to use client().admin().cluster().prepareNodesStats().get() which will give you an iterator over some NodeStats objects, and these objects have a getThreadPool property that you can use to get information about thread pools.


(Ed Brown) #3

Adrien
Thank you. You sent me in the right direction, but it missing one method call. The solution is:
client().admin().prepareNodesStats().all().get();

Thank you! :smiley:
Ed Brown
Software Architect


(system) #4