You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*[Development and Community](#development-and-community)
87
+
72
88
The client supports many configurations options for setting up and managing connections,
73
89
configuring logging, customizing the transport library, etc.
74
90
@@ -178,6 +194,33 @@ You can pass the client any conforming logger implementation:
178
194
179
195
client = Elasticsearch::Client.new logger: log
180
196
197
+
### Identifying running tasks with X-Opaque-Id
198
+
199
+
The X-Opaque-Id header allows to track certain calls, or associate certain tasks with the client that started them ([more on the Elasticsearch docs](https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html#_identifying_running_tasks)). To use this feature, you need to set an id for `opaque_id` on the client before each request. Example:
200
+
201
+
```ruby
202
+
client =Elasticsearch::Client.new
203
+
client.opaque_id ='123456'
204
+
client.search(index:'myindex', q:'title:test')
205
+
```
206
+
The search request will include the following HTTP Header:
207
+
```
208
+
X-Opaque-Id: 123456
209
+
```
210
+
211
+
Please note that `opaque_id` will be set to nil after every request, so you need to set it on the client for every individual request.
212
+
213
+
You can also set a prefix for X-Opaque-Id when initializing the client. This will be prepended to the id you set before each request if you're using X-Opaque-Id. Example:
0 commit comments