# How can I set x-opaque-id when I use es-sql？

**URL:** <https://discuss.elastic.co/t/how-can-i-set-x-opaque-id-when-i-use-es-sql/256065>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-sql\
**Created:** [November 20, 2020, 6:44am UTC](https://discuss.elastic.co/t/how-can-i-set-x-opaque-id-when-i-use-es-sql/256065 "2020-11-20T06:44:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ITzhangqiang](https://avatars.discourse-cdn.com/v4/letter/i/2bfe46/32.png) [@ITzhangqiang](https://discuss.elastic.co/u/ITzhangqiang)\
**Post date:** [November 20, 2020, 6:44am UTC](https://discuss.elastic.co/t/how-can-i-set-x-opaque-id-when-i-use-es-sql/256065/1 "2020-11-20T06:44:48Z")

</div>

Hi,all  
How can I set x-opaque-id when I use es-sql？

---

<div class="post-metadata">

**Author:** ![ITzhangqiang](https://avatars.discourse-cdn.com/v4/letter/i/2bfe46/32.png) [@ITzhangqiang](https://discuss.elastic.co/u/ITzhangqiang)\
**Post date:** [November 23, 2020, 3:34am UTC](https://discuss.elastic.co/t/how-can-i-set-x-opaque-id-when-i-use-es-sql/256065/2 "2020-11-23T03:34:59Z")

</div>

@dadoonet

---

<div class="post-metadata">

**Author:** ![bogdan.pintea](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bogdan.pintea/32/45740_2.png) [@bogdan.pintea](https://discuss.elastic.co/u/bogdan.pintea)\
**Post date:** [November 23, 2020, 1:09pm UTC](https://discuss.elastic.co/t/how-can-i-set-x-opaque-id-when-i-use-es-sql/256065/3 "2020-11-23T13:09:58Z")

</div>

> [@ITzhangqiang](#):
>
> Hi,all

No individual pings, please, kindly keep it to `all`. Thanks.

> [@ITzhangqiang](#):
>
> How can I set x-opaque-id when I use es-sql？

You'd have to set it as a header, just like with the other REST APIs - see [reference documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html#_identifying_running_tasks) - and you'd get back the value as a header. Though I assume you did that -- did it not work?

---

<div class="post-metadata">

**Author:** ![ITzhangqiang](https://avatars.discourse-cdn.com/v4/letter/i/2bfe46/32.png) [@ITzhangqiang](https://discuss.elastic.co/u/ITzhangqiang)\
**Post date:** [November 24, 2020, 2:02am UTC](https://discuss.elastic.co/t/how-can-i-set-x-opaque-id-when-i-use-es-sql/256065/4 "2020-11-24T02:02:52Z")

</div>

Thanks,  
I use jdbc not REST API，so I don't know where to set it in jdbc connection

---

<div class="post-metadata">

**Author:** ![bogdan.pintea](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bogdan.pintea/32/45740_2.png) [@bogdan.pintea](https://discuss.elastic.co/u/bogdan.pintea)\
**Post date:** [November 26, 2020, 7:38am UTC](https://discuss.elastic.co/t/how-can-i-set-x-opaque-id-when-i-use-es-sql/256065/5 "2020-11-26T07:38:19Z")

</div>

> [@ITzhangqiang](#):
>
> I don't know where to set it in jdbc connection

I think that's currently not possible, JDBC doesn't take a configuration property for that, unfortunately. Feel free to open an issue / feature request on [Github](https://github.com/elastic/elasticsearch/issues), though.

As a hacky alternative, I guess you could SELECT a unique literal token in the SQL query itself, if that's at all feasible, to help correlate requests and responses.

---

<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:** [December 24, 2020, 7:38am UTC](https://discuss.elastic.co/t/how-can-i-set-x-opaque-id-when-i-use-es-sql/256065/6 "2020-12-24T07:38:24Z")

</div>

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