# How to high level rest client request request nodes stats URGENT!

**URL:** https://discuss.elastic.co/t/how-to-high-level-rest-client-request-request-nodes-stats-urgent/170324
**Category:** Elasticsearch
**Created:** [February 28, 2019, 11:19am UTC](https://discuss.elastic.co/t/how-to-high-level-rest-client-request-request-nodes-stats-urgent/170324 "2019-02-28T11:19:41Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![khergner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/khergner/32/130758_2.png) [@khergner](https://discuss.elastic.co/u/khergner)
#### Post date: [February 28, 2019, 11:19am UTC](https://discuss.elastic.co/t/how-to-high-level-rest-client-request-request-nodes-stats-urgent/170324/1 "2019-02-28T11:19:41Z")

</div>

Hi,  
I want to use high rest client for metric collector on java. There is a url ([http://172](http://172).\*\*\*\*_:9200//\_nodes/172.28.._/stats/os). Response about metric data and I read [here](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/6.6/java-rest-high.html) . How can ı do request? Which can ı use any method? can you help me?

---

<div class="post-metadata">

### Author: ![khergner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/khergner/32/130758_2.png) [@khergner](https://discuss.elastic.co/u/khergner)
#### Post date: [February 28, 2019, 1:08pm UTC](https://discuss.elastic.co/t/how-to-high-level-rest-client-request-request-nodes-stats-urgent/170324/2 "2019-02-28T13:08:53Z")

</div>

Actually, I want to do;  
**For example with Java low level Rest client**

```
RestClient restClient = RestClient.builder(new HttpHost(remoteIp, 9200)).build();
Request request = new Request("GET", "/_nodes/172.28.25.239/stats/os");
Response response = restClient.performRequest(request);
String body = EntityUtils.toString(response.getEntity());

```

**How can ı do with Java highlevel Rest client?**

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [February 28, 2019, 1:15pm UTC](https://discuss.elastic.co/t/how-to-high-level-rest-client-request-request-nodes-stats-urgent/170324/3 "2019-02-28T13:15:56Z")

</div>

I don't think this API has been exposed yet in the HLClient.  
So falling back to the Low Level Client as you did seems to me the right solution.

BTW I don't think it will be supported according to:

> <https://github.com/elastic/elasticsearch/issues/27205>

---

<div class="post-metadata">

### Author: ![khergner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/khergner/32/130758_2.png) [@khergner](https://discuss.elastic.co/u/khergner)
#### Post date: [February 28, 2019, 1:23pm UTC](https://discuss.elastic.co/t/how-to-high-level-rest-client-request-request-nodes-stats-urgent/170324/4 "2019-02-28T13:23:41Z")

</div>

> [@dadoonet](#):
>
> So falling back to the Low Level Client as you did seems to me the right solution.

I think ı use LLClient as seems to the right solution. Maven file use two dependencies so doesn't look good at all. 🙂

```
		<dependency>
			<groupId>org.elasticsearch.client</groupId>
			<artifactId>elasticsearch-rest-high-level-client</artifactId>
			<version>6.6.1</version>
		</dependency>
		
		<dependency>
			<groupId>org.elasticsearch.client</groupId>
			<artifactId>elasticsearch-rest-client</artifactId>
			<version>6.6.1</version>
		</dependency>

```

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [February 28, 2019, 1:38pm UTC](https://discuss.elastic.co/t/how-to-high-level-rest-client-request-request-nodes-stats-urgent/170324/5 "2019-02-28T13:38:27Z")

</div>

When I say fallback to the low level does not mean that you can not use the HLClient for the other APIs.

And you don't have to declare both deps in you code.

```auto
<dependency>
  <groupId>org.elasticsearch.client</groupId>
  <artifactId>elasticsearch-rest-high-level-client</artifactId>
  <version>6.6.1</version>
</dependency>

```

is enough.

---

<div class="post-metadata">

### Author: ![khergner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/khergner/32/130758_2.png) [@khergner](https://discuss.elastic.co/u/khergner)
#### Post date: [March 1, 2019, 5:53am UTC](https://discuss.elastic.co/t/how-to-high-level-rest-client-request-request-nodes-stats-urgent/170324/6 "2019-03-01T05:53:28Z")

</div>

Hi David,  
Thank you for response 😀  
Best regards

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [March 29, 2019, 5:53am UTC](https://discuss.elastic.co/t/how-to-high-level-rest-client-request-request-nodes-stats-urgent/170324/7 "2019-03-29T05:53:37Z")

</div>

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