# How to create a client with the protect of SearchGuard By Class RestHighLevelClient

**URL:** https://discuss.elastic.co/t/how-to-create-a-client-with-the-protect-of-searchguard-by-class-resthighlevelclient/165185
**Category:** Elasticsearch
**Created:** [January 22, 2019, 8:34am UTC](https://discuss.elastic.co/t/how-to-create-a-client-with-the-protect-of-searchguard-by-class-resthighlevelclient/165185 "2019-01-22T08:34:10Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![AveiShriety](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aveishriety/32/40058_2.png) [@AveiShriety](https://discuss.elastic.co/u/AveiShriety)
#### Post date: [January 22, 2019, 8:34am UTC](https://discuss.elastic.co/t/how-to-create-a-client-with-the-protect-of-searchguard-by-class-resthighlevelclient/165185/1 "2019-01-22T08:34:10Z")

</div>

Now, I use `SearchGuard` to secure my elasticsearch cluster.

And in the **search-guard** official website, I found the [Transport Clients](https://docs.search-guard.com/latest/elasticsearch-transport-clients-search-guard) to create A client. But, due to the **Elasticsearch** official website's declare:

> We plan on deprecating the `TransportClient` in Elasticsearch 7.0 and removing it completely in 8.0. Instead, you should be using the [Java High Level REST Client](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/6.5/java-rest-high.html), which executes HTTP requests rather than serialized Java requests.

So I prefer to use Class `RestHighLevelClient` to create the elasticsearch client!  
But in this way, how could I write the code? Could someone provide the demo?  
Thanks!

---

<div class="post-metadata">

### Author: ![ikakavas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ikakavas/32/34430_2.png) [@ikakavas](https://discuss.elastic.co/u/ikakavas)
#### Post date: [January 22, 2019, 8:51am UTC](https://discuss.elastic.co/t/how-to-create-a-client-with-the-protect-of-searchguard-by-class-resthighlevelclient/165185/2 "2019-01-22T08:51:33Z")

</div>

Hi,

You might have better chances of getting a helpful answer if you post the question in an issue for the plugin developers on [github](https://github.com/floragunncom/search-guard)

---

<div class="post-metadata">

### Author: ![AveiShriety](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aveishriety/32/40058_2.png) [@AveiShriety](https://discuss.elastic.co/u/AveiShriety)
#### Post date: [January 22, 2019, 8:55am UTC](https://discuss.elastic.co/t/how-to-create-a-client-with-the-protect-of-searchguard-by-class-resthighlevelclient/165185/3 "2019-01-22T08:55:17Z")

</div>

OK ，Fine , thanks for you advice!  
I will go to do it.  
😀

---

<div class="post-metadata">

### Author: ![AveiShriety](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aveishriety/32/40058_2.png) [@AveiShriety](https://discuss.elastic.co/u/AveiShriety)
#### Post date: [January 23, 2019, 7:14am UTC](https://discuss.elastic.co/t/how-to-create-a-client-with-the-protect-of-searchguard-by-class-resthighlevelclient/165185/4 "2019-01-23T07:14:57Z")

</div>

Could Somebody have a good answer to me ?  
Help~Help~

---

<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: [January 23, 2019, 7:31am UTC](https://discuss.elastic.co/t/how-to-create-a-client-with-the-protect-of-searchguard-by-class-resthighlevelclient/165185/5 "2019-01-23T07:31:55Z")

</div>

I think you need to wait for an answer at:

> <https://github.com/floragunncom/search-guard/issues/622>

---

<div class="post-metadata">

### Author: ![AveiShriety](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aveishriety/32/40058_2.png) [@AveiShriety](https://discuss.elastic.co/u/AveiShriety)
#### Post date: [January 23, 2019, 11:41pm UTC](https://discuss.elastic.co/t/how-to-create-a-client-with-the-protect-of-searchguard-by-class-resthighlevelclient/165185/6 "2019-01-23T23:41:57Z")

</div>

yeah~ this is also the question I raised in the github!  
May be, as you said, I need to wait!  
Always thank you.

---

<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: [February 20, 2019, 11:41pm UTC](https://discuss.elastic.co/t/how-to-create-a-client-with-the-protect-of-searchguard-by-class-resthighlevelclient/165185/7 "2019-02-20T23:41:58Z")

</div>

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