Skip to content

Commit 74d9e56

Browse files
feat: Created specs for ltr plugin for stats endpoints (#829)
Signed-off-by: Johannes Peter <[email protected]>
1 parent 28f4510 commit 74d9e56

File tree

6 files changed

+227
-0
lines changed

6 files changed

+227
-0
lines changed

.github/workflows/test-spec.yml

+2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ jobs:
5757
tests: plugins/analysis
5858
- version: 2.19.0
5959
tests: plugins/knn
60+
- version: 2.19.0
61+
tests: plugins/learning_to_rank
6062
- version: 2.19.0
6163
tests: plugins/security
6264
cert: tests/plugins/security/.kirk.pem

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
55
## [Unreleased]
66

77
### Added
8+
- Added specs for LTR plugin for stats endpoints ([#786](https://github.com/opensearch-project/opensearch-api-specification/issues/786/))
89
- Added defaults for Cluster APIs ([#824](https://github.com/opensearch-project/opensearch-api-specification/pull/824/))
910
- Added `aggs` alias for nested aggregations ([#818](https://github.com/opensearch-project/opensearch-api-specification/pull/818))
1011
- Added API specs for query groups lifecycle APIs ([#649](https://github.com/opensearch-project/opensearch-api-specification/pull/649))

spec/namespaces/ltr.yaml

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
openapi: 3.1.0
2+
info:
3+
title: OpenSearch ML API
4+
description: OpenSearch ML API.
5+
version: 1.0.0
6+
paths:
7+
/_plugins/_ltr/stats:
8+
get:
9+
operationId: ltr.stats.0
10+
x-operation-group: ltr.stats
11+
x-version-added: '1.0'
12+
description: Provides information about the current status of the LTR plugin.
13+
parameters:
14+
- $ref: '#/components/parameters/ltr.stats::query.timeout'
15+
responses:
16+
'200':
17+
$ref: '#/components/responses/ltr.stats@200'
18+
19+
/_plugins/_ltr/stats/{stat}:
20+
get:
21+
operationId: ltr.stats.1
22+
x-operation-group: ltr.stats
23+
x-version-added: '1.0'
24+
description: Provides information about the current status of the LTR plugin.
25+
parameters:
26+
- $ref: '#/components/parameters/ltr.stats::path.stat'
27+
- $ref: '#/components/parameters/ltr.stats::query.timeout'
28+
responses:
29+
'200':
30+
$ref: '#/components/responses/ltr.stats@200'
31+
32+
/_plugins/_ltr/{node_id}/stats:
33+
get:
34+
operationId: ltr.stats.2
35+
x-operation-group: ltr.stats
36+
x-version-added: '1.0'
37+
description: Provides information about the current status of the LTR plugin.
38+
parameters:
39+
- $ref: '#/components/parameters/ltr.stats::path.node_id'
40+
- $ref: '#/components/parameters/ltr.stats::query.timeout'
41+
responses:
42+
'200':
43+
$ref: '#/components/responses/ltr.stats@200'
44+
45+
/_plugins/_ltr/{node_id}/stats/{stat}:
46+
get:
47+
operationId: ltr.stats.3
48+
x-operation-group: ltr.stats
49+
x-version-added: '1.0'
50+
description: Provides information about the current status of the LTR plugin.
51+
parameters:
52+
- $ref: '#/components/parameters/ltr.stats::path.node_id'
53+
- $ref: '#/components/parameters/ltr.stats::path.stat'
54+
- $ref: '#/components/parameters/ltr.stats::query.timeout'
55+
responses:
56+
'200':
57+
$ref: '#/components/responses/ltr.stats@200'
58+
59+
60+
components:
61+
parameters:
62+
ltr.stats::query.timeout:
63+
name: timeout
64+
in: query
65+
description: The time in milliseconds to wait for a response.
66+
schema:
67+
$ref: '../schemas/_common.yaml#/components/schemas/Duration'
68+
ltr.stats::path.stat:
69+
name: stat
70+
in: path
71+
description: Comma-separated list of stats to retrieve; use `_all` or empty string to retrieve all stats.
72+
schema:
73+
type: array
74+
description: Comma-separated list of stats to retrieve; use `_all` or empty string to retrieve all stats.
75+
items:
76+
type: string
77+
enum:
78+
- cache
79+
- request_error_count
80+
- request_total_count
81+
required: true
82+
ltr.stats::path.node_id:
83+
name: node_id
84+
in: path
85+
description: Comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes.
86+
schema:
87+
type: array
88+
description: Comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes.
89+
items:
90+
type: string
91+
required: true
92+
93+
responses:
94+
ltr.stats@200:
95+
content:
96+
application/json:
97+
schema:
98+
$ref: '../schemas/ltr._common.yaml#/components/schemas/Stats'

spec/schemas/ltr._common.yaml

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
openapi: 3.1.0
2+
info:
3+
title: Schemas of `knn._common` Category
4+
description: Schemas of `knn._common` category.
5+
version: 1.0.0
6+
paths: {}
7+
components:
8+
schemas:
9+
Stats:
10+
type: object
11+
properties:
12+
_nodes:
13+
$ref: '_common.yaml#/components/schemas/NodeStatistics'
14+
cluster_name:
15+
$ref: '_common.yaml#/components/schemas/Name'
16+
stores:
17+
$ref: '#/components/schemas/StoreStats'
18+
status:
19+
type: string
20+
nodes:
21+
type: object
22+
additionalProperties:
23+
$ref: '#/components/schemas/NodeStats'
24+
StoreStats:
25+
type: object
26+
additionalProperties:
27+
$ref: '#/components/schemas/StoreStat'
28+
StoreStat:
29+
type: object
30+
properties:
31+
model_count:
32+
type: integer
33+
featureset_count:
34+
type: integer
35+
feature_count:
36+
type: integer
37+
status:
38+
type: string
39+
NodeStats:
40+
type: object
41+
properties:
42+
cache:
43+
$ref: '#/components/schemas/CacheStats'
44+
request_total_count:
45+
type: integer
46+
request_error_count:
47+
type: integer
48+
CacheStats:
49+
type: object
50+
properties:
51+
feature:
52+
$ref: '#/components/schemas/CacheStat'
53+
featureset:
54+
$ref: '#/components/schemas/CacheStat'
55+
model:
56+
$ref: '#/components/schemas/CacheStat'
57+
CacheStat:
58+
type: object
59+
properties:
60+
eviction_count:
61+
type: integer
62+
miss_count:
63+
type: integer
64+
entry_count:
65+
type: integer
66+
memory_usage_in_bytes:
67+
type: integer
68+
hit_count:
69+
type: integer
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: '3'
2+
3+
services:
4+
opensearch-cluster:
5+
image: ${OPENSEARCH_DOCKER_HUB_PROJECT:-opensearchproject}/opensearch:${OPENSEARCH_VERSION:-latest}${OPENSEARCH_DOCKER_REF}
6+
ports:
7+
- 9200:9200
8+
- 9600:9600
9+
environment:
10+
- OPENSEARCH_INITIAL_ADMIN_PASSWORD=${OPENSEARCH_PASSWORD:-myStrongPassword123!}
11+
- OPENSEARCH_JAVA_OPTS=${OPENSEARCH_JAVA_OPTS}
12+
- discovery.type=single-node
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
$schema: ../../../../json_schemas/test_story.schema.yaml
2+
3+
description: Get LTR stats.
4+
prologues:
5+
- method: PUT
6+
path: _ltr
7+
status: [200, 400]
8+
9+
epilogues:
10+
- path: _ltr
11+
method: DELETE
12+
status: [200, 404]
13+
14+
chapters:
15+
- synopsis: Get LTR stats.
16+
method: GET
17+
path: /_plugins/_ltr/stats
18+
response:
19+
status: 200
20+
- synopsis: Get LTR stat.
21+
method: GET
22+
path: /_plugins/_ltr/stats/{stat}
23+
parameters:
24+
stat:
25+
- cache
26+
response:
27+
status: 200
28+
- synopsis: Get LTR stats for certain node.
29+
method: GET
30+
path: /_plugins/_ltr/{node_id}/stats
31+
parameters:
32+
node_id:
33+
- _all
34+
response:
35+
status: 200
36+
- synopsis: Get LTR stat for certain node.
37+
method: GET
38+
path: /_plugins/_ltr/{node_id}/stats/{stat}
39+
parameters:
40+
node_id:
41+
- _all
42+
stat:
43+
- cache
44+
response:
45+
status: 200

0 commit comments

Comments
 (0)