Skip to content

Commit 0ff9c6e

Browse files
authored
[DOCS] Adds X-Pack usage API (#52496)
1 parent 1c1d451 commit 0ff9c6e

File tree

4 files changed

+296
-2
lines changed

4 files changed

+296
-2
lines changed

docs/reference/rest-api/index.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ not be included yet.
3131
* <<security-api,Security APIs>>
3232
* <<snapshot-lifecycle-management-api,Snapshot lifecycle management APIs>>
3333
* <<transform-apis,{transform-cap} APIs>>
34+
* <<usage-api,Usage API>>
3435
* <<watcher-api,Watcher APIs>>
3536
--
3637

@@ -56,5 +57,6 @@ include::{es-repo-dir}/search.asciidoc[]
5657
include::{xes-repo-dir}/rest-api/security.asciidoc[]
5758
include::{es-repo-dir}/slm/apis/slm-api.asciidoc[]
5859
include::{es-repo-dir}/transform/apis/index.asciidoc[]
60+
include::usage.asciidoc[]
5961
include::{xes-repo-dir}/rest-api/watcher.asciidoc[]
6062
include::defs.asciidoc[]

docs/reference/rest-api/info.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ The information provided by this API includes:
3636
The default value is `true`.
3737

3838
[discrete]
39-
[[info-api--example]]
39+
[[info-api-example]]
4040
=== {api-examples-title}
4141

4242
The following example queries the info API:
Lines changed: 292 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,292 @@
1+
[role="xpack"]
2+
[testenv="basic"]
3+
[[usage-api]]
4+
== Usage API
5+
6+
Provides usage information about the installed {xpack} features.
7+
8+
[discrete]
9+
[[usage-api-request]]
10+
=== {api-request-title}
11+
12+
`GET /_xpack/usage`
13+
14+
[discrete]
15+
[[usage-api-desc]]
16+
=== {api-description-title}
17+
18+
This API provides information about which features are currently enabled and
19+
available under the current license and some usage statistics.
20+
21+
[discrete]
22+
[[usage-api-query-parms]]
23+
=== {api-query-parms-title}
24+
25+
include::{docdir}/rest-api/common-parms.asciidoc[tag=master-timeout]
26+
27+
[discrete]
28+
[[usage-api-example]]
29+
=== {api-examples-title}
30+
31+
[source,console]
32+
------------------------------------------------------------
33+
GET /_xpack/usage
34+
------------------------------------------------------------
35+
36+
[source,console-result]
37+
------------------------------------------------------------
38+
{
39+
"security" : {
40+
"available" : true,
41+
"enabled" : false,
42+
"ssl" : {
43+
"http" : {
44+
"enabled" : false
45+
},
46+
"transport" : {
47+
"enabled" : false
48+
}
49+
}
50+
},
51+
"monitoring" : {
52+
"available" : true,
53+
"enabled" : true,
54+
"collection_enabled" : false,
55+
"enabled_exporters" : {
56+
"local" : 1
57+
}
58+
},
59+
"watcher" : {
60+
"available" : true,
61+
"enabled" : true,
62+
"execution" : {
63+
"actions" : {
64+
"_all" : {
65+
"total" : 0,
66+
"total_time_in_ms" : 0
67+
}
68+
}
69+
},
70+
"watch" : {
71+
"input" : {
72+
"_all" : {
73+
"total" : 0,
74+
"active" : 0
75+
}
76+
},
77+
"trigger" : {
78+
"_all" : {
79+
"total" : 0,
80+
"active" : 0
81+
}
82+
}
83+
},
84+
"count" : {
85+
"total" : 0,
86+
"active" : 0
87+
}
88+
},
89+
"graph" : {
90+
"available" : true,
91+
"enabled" : true
92+
},
93+
"ml" : {
94+
"available" : true,
95+
"enabled" : true,
96+
"jobs" : {
97+
"_all" : {
98+
"count" : 0,
99+
"detectors" : {
100+
...
101+
},
102+
"created_by" : { },
103+
"model_size" : {
104+
...
105+
},
106+
"forecasts" : {
107+
"total" : 0,
108+
"forecasted_jobs" : 0
109+
}
110+
}
111+
},
112+
"datafeeds" : {
113+
"_all" : {
114+
"count" : 0
115+
}
116+
},
117+
"data_frame_analytics_jobs" : {
118+
"_all" : {
119+
"count" : 0
120+
}
121+
},
122+
"inference" : {
123+
"ingest_processors" : {
124+
"_all" : {
125+
"num_docs_processed" : {
126+
"max" : 0,
127+
"sum" : 0,
128+
"min" : 0
129+
},
130+
"pipelines" : {
131+
"count" : 0
132+
},
133+
"num_failures" : {
134+
"max" : 0,
135+
"sum" : 0,
136+
"min" : 0
137+
},
138+
"time_ms" : {
139+
"max" : 0,
140+
"sum" : 0,
141+
"min" : 0
142+
}
143+
}
144+
},
145+
"trained_models" : {
146+
"_all" : {
147+
"count" : 0
148+
}
149+
}
150+
},
151+
"node_count" : 1
152+
},
153+
"logstash" : {
154+
"available" : true,
155+
"enabled" : true
156+
},
157+
"eql" : {
158+
"available" : true,
159+
"enabled" : true
160+
},
161+
"sql" : {
162+
"available" : true,
163+
"enabled" : true,
164+
"features" : {
165+
"having" : 0,
166+
"subselect" : 0,
167+
"limit" : 0,
168+
"orderby" : 0,
169+
"where" : 0,
170+
"join" : 0,
171+
"groupby" : 0,
172+
"command" : 0,
173+
"local" : 0
174+
},
175+
"queries" : {
176+
"rest" : {
177+
"total" : 0,
178+
"paging" : 0,
179+
"failed" : 0
180+
},
181+
"cli" : {
182+
"total" : 0,
183+
"paging" : 0,
184+
"failed" : 0
185+
},
186+
"canvas" : {
187+
"total" : 0,
188+
"paging" : 0,
189+
"failed" : 0
190+
},
191+
"odbc" : {
192+
"total" : 0,
193+
"paging" : 0,
194+
"failed" : 0
195+
},
196+
"jdbc" : {
197+
"total" : 0,
198+
"paging" : 0,
199+
"failed" : 0
200+
},
201+
"odbc32" : {
202+
"total" : 0,
203+
"paging" : 0,
204+
"failed" : 0
205+
},
206+
"odbc64" : {
207+
"total" : 0,
208+
"paging" : 0,
209+
"failed" : 0
210+
},
211+
"_all" : {
212+
"total" : 0,
213+
"paging" : 0,
214+
"failed" : 0
215+
},
216+
"translate" : {
217+
"count" : 0
218+
}
219+
}
220+
},
221+
"rollup" : {
222+
"available" : true,
223+
"enabled" : true
224+
},
225+
"ilm" : {
226+
"policy_count" : 3,
227+
"policy_stats" : [
228+
...
229+
]
230+
},
231+
"slm" : {
232+
"available" : true,
233+
"enabled" : true
234+
},
235+
"ccr" : {
236+
"available" : true,
237+
"enabled" : true,
238+
"follower_indices_count" : 0,
239+
"auto_follow_patterns_count" : 0
240+
},
241+
"transform" : {
242+
"available" : true,
243+
"enabled" : true
244+
},
245+
"flattened" : {
246+
"available" : true,
247+
"enabled" : true,
248+
"field_count" : 0
249+
},
250+
"vectors" : {
251+
"available" : true,
252+
"enabled" : true,
253+
"dense_vector_fields_count" : 0,
254+
"dense_vector_dims_avg_count" : 0
255+
},
256+
"voting_only" : {
257+
"available" : true,
258+
"enabled" : true
259+
},
260+
"frozen_indices" : {
261+
"available" : true,
262+
"enabled" : true,
263+
"indices_count" : 0
264+
},
265+
"spatial" : {
266+
"available" : true,
267+
"enabled" : true
268+
},
269+
"analytics" : {
270+
"available" : true,
271+
"enabled" : true
272+
}
273+
}
274+
------------------------------------------------------------
275+
// TESTRESPONSE[s/"detectors" : \{[^\}]*\},/"detectors" : $body.$_path,/]
276+
// TESTRESPONSE[s/"model_size" : \{[^\}]*\},/"model_size" : $body.$_path,/]
277+
// TESTRESPONSE[s/"eql" : \{[^\}]*\},/"eql" : $body.$_path,/]
278+
// TESTRESPONSE[s/"policy_stats" : \[[^\]]*\]/"policy_stats" : $body.$_path/]
279+
// TESTRESPONSE[s/"slm" : \{[^\}]*\},/"slm" : $body.$_path,/]
280+
// TESTRESPONSE[s/ : true/ : $body.$_path/]
281+
// TESTRESPONSE[s/ : false/ : $body.$_path/]
282+
// TESTRESPONSE[s/ : (\-)?[0-9]+/ : $body.$_path/]
283+
// These replacements do a few things:
284+
// 1. Ignore the contents of the `policy_stats` object because we don't know all
285+
// of the policies that will be in it. And because we figure folks don't need
286+
// to see an exhaustive list anyway.
287+
// 2. Handling eql, which is disabled by default on release builds and enabled
288+
// everywhere else during the initial implementation phase until its release
289+
// 3. Ignore the contents of the `slm` object because it might contain policies
290+
// 4. All of the numbers and strings on the right hand side of *every* field in
291+
// the response are ignored. So we're really only asserting things about the
292+
// the shape of this response, not the values in it.

x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.usage.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"xpack.usage":{
33
"documentation":{
4-
"url":"Retrieve information about xpack features usage"
4+
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/usage-api.html"
55
},
66
"stability":"stable",
77
"url":{

0 commit comments

Comments
 (0)