@@ -83,6 +83,41 @@ logger.index_search_slowlog_rolling.appenderRef.index_search_slowlog_rolling.ref
8383logger.index_search_slowlog_rolling.additivity = false
8484--------------------------------------------------
8585
86+ [float]
87+ ==== Identifying search slow log origin
88+
89+ It is often useful to identify what triggered a slow running query. If a call was initiated with an `X-Opaque-ID` header, then the user ID
90+ is included in Search Slow logs as an additional **id** field (scroll to the right).
91+ [source,txt]
92+ ---------------------------
93+ [2030-08-30T11:59:37,786][WARN ][i.s.s.query ] [node-0] [index6][0] took[78.4micros], took_millis[0], total_hits[0 hits], stats[], search_type[QUERY_THEN_FETCH], total_shards[1], source[{"query":{"match_all":{"boost":1.0}}}], id[MY_USER_ID],
94+ ---------------------------
95+ // NOTCONSOLE
96+ The user ID is also included in JSON logs.
97+ [source,js]
98+ ---------------------------
99+ {
100+ "type": "index_search_slowlog",
101+ "timestamp": "2030-08-30T11:59:37,786+02:00",
102+ "level": "WARN",
103+ "component": "i.s.s.query",
104+ "cluster.name": "distribution_run",
105+ "node.name": "node-0",
106+ "message": "[index6][0]",
107+ "took": "78.4micros",
108+ "took_millis": "0",
109+ "total_hits": "0 hits",
110+ "stats": "[]",
111+ "search_type": "QUERY_THEN_FETCH",
112+ "total_shards": "1",
113+ "source": "{\"query\":{\"match_all\":{\"boost\":1.0}}}",
114+ "id": "MY_USER_ID",
115+ "cluster.uuid": "Aq-c-PAeQiK3tfBYtig9Bw",
116+ "node.id": "D7fUYfnfTLa2D7y-xw6tZg"
117+ }
118+ ---------------------------
119+ // NOTCONSOLE
120+
86121[float]
87122[[index-slow-log]]
88123=== Index Slow log
0 commit comments