# How can I set X-Opaque-Id while using restHighLevelClient?

**URL:** <https://discuss.elastic.co/t/how-can-i-set-x-opaque-id-while-using-resthighlevelclient/283390>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [September 6, 2021, 1:46am UTC](https://discuss.elastic.co/t/how-can-i-set-x-opaque-id-while-using-resthighlevelclient/283390 "2021-09-06T01:46:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yeziblo](https://avatars.discourse-cdn.com/v4/letter/y/74df32/32.png) [@yeziblo](https://discuss.elastic.co/u/yeziblo)\
**Post date:** [September 6, 2021, 1:46am UTC](https://discuss.elastic.co/t/how-can-i-set-x-opaque-id-while-using-resthighlevelclient/283390/1 "2021-09-06T01:46:20Z")

</div>

Hi everyone.

Can I set X-Opaque-Id while using restHighLevelClient so that I can trace it in the slow log.

And if so, how to set?

Any advice is helpful.

best regards.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [September 6, 2021, 7:46am UTC](https://discuss.elastic.co/t/how-can-i-set-x-opaque-id-while-using-resthighlevelclient/283390/2 "2021-09-06T07:46:19Z")

</div>

something like

```java
RequestOptions options = 
  RequestOptions.DEFAULT.toBuilder().addHeader("X-Opaque-Id", "my-id").build();

ClusterHealthResponse response = client.cluster().health(new ClusterHealthRequest(), options);

```

--Alex

---

<div class="post-metadata">

**Author:** ![yeziblo](https://avatars.discourse-cdn.com/v4/letter/y/74df32/32.png) [@yeziblo](https://discuss.elastic.co/u/yeziblo)\
**Post date:** [September 6, 2021, 7:58am UTC](https://discuss.elastic.co/t/how-can-i-set-x-opaque-id-while-using-resthighlevelclient/283390/3 "2021-09-06T07:58:06Z")

</div>

Thanks Alex, I'll try it.

---

<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:** [October 4, 2021, 7:58am UTC](https://discuss.elastic.co/t/how-can-i-set-x-opaque-id-while-using-resthighlevelclient/283390/4 "2021-10-04T07:58:33Z")

</div>

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