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
You can set a custom HTTP header on the client's initializer:
210
232
211
-
log = Logging.logger['elasticsearch']
212
-
log.add_appenders Logging.appenders.stdout
213
-
log.level = :info
233
+
```ruby
234
+
client =Elasticsearch::Client.new(
235
+
transport_options: {
236
+
headers:
237
+
{user_agent:"My Ruby App"}
238
+
}
239
+
)
240
+
```
214
241
215
-
client = Elasticsearch::Client.new logger: log
216
242
### Identifying running tasks with X-Opaque-Id
217
243
218
244
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 on each request. Example:
@@ -330,25 +356,29 @@ preferring HTTP clients with support for persistent connections.
330
356
331
357
To use the [_Patron_](https://github.com/toland/patron) HTTP, for example, just require it:
332
358
333
-
require 'patron'
359
+
```ruby
360
+
require'patron'
361
+
```
334
362
335
363
Then, create a new client, and the _Patron_ gem will be used as the "driver":
0 commit comments