Skip to content

Commit 023501d

Browse files
committed
added doc for using the opaque id
1 parent 3940a27 commit 023501d

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

docs/per-request-configuration.asciidoc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,32 @@
44
There are several configurations that can be set on a per-request basis, rather than at a connection- or client-level.
55
These are specified as part of the request associative array.
66

7+
8+
=== Request Identification
9+
10+
You can enrich your requests against Elasticsearch with an identifier string, that allows you to discover this identifier
11+
in https://www.elastic.co/guide/en/elasticsearch/reference/7.4/logging.html#deprecation-logging[deprecation logs], to support you with
12+
https://www.elastic.co/guide/en/elasticsearch/reference/7.4/index-modules-slowlog.html#_identifying_search_slow_log_origin[identifying search slow log origin]
13+
or to help with https://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html#_identifying_running_tasks[identifying running tasks].
14+
15+
16+
[source,php]
17+
----
18+
$client = ClientBuilder::create()->build();
19+
20+
$params = [
21+
'index' => 'test',
22+
'id' => 1,
23+
'client' => [
24+
'opaqueId' => '[email protected]_user1234', <1>
25+
]
26+
];
27+
$response = $client->get($params);
28+
29+
----
30+
<1> This will populate the `X-Opaque-Id` header with the value `app17@dc06_user1234_1234`
31+
32+
733
=== Ignoring exceptions
834
The library attempts to throw exceptions for common problems. These exceptions match the HTTP response code provided
935
by Elasticsearch. For example, attempting to GET a nonexistent document will throw a `MissingDocument404Exception`.

0 commit comments

Comments
 (0)