Skip to content

Commit c3d4ce5

Browse files
committed
Add query rules tester spec
1 parent 82461cc commit c3d4ce5

File tree

7 files changed

+248
-32
lines changed

7 files changed

+248
-32
lines changed

output/schema/schema.json

Lines changed: 96 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/schema/validation-errors.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/typescript/types.ts

Lines changed: 10 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"query_rules.test": {
3+
"documentation": {
4+
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/test-query-ruleset.html",
5+
"description": "Tests a query ruleset to identify the rules that would match input criteria"
6+
},
7+
"stability": "experimental",
8+
"visibility": "public",
9+
"headers": {
10+
"accept": ["application/json"],
11+
"content_type": ["application/json"]
12+
},
13+
"url": {
14+
"paths": [
15+
{
16+
"path": "/_query_rules/{ruleset_id}/_test",
17+
"methods": ["POST"],
18+
"parts": {
19+
"ruleset_id": {
20+
"type": "string",
21+
"description": "The unique identifier of the ruleset to test."
22+
}
23+
}
24+
}
25+
]
26+
},
27+
"body": {
28+
"description": "The match criteria to test against the ruleset",
29+
"required": true
30+
}
31+
}
32+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
import { RequestBase } from '@_types/Base'
20+
import { Id } from '@_types/common'
21+
import { Dictionary } from '@spec_utils/Dictionary'
22+
import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
23+
24+
/**
25+
* Creates or updates a query ruleset.
26+
* @rest_spec_name query_rules.put_ruleset
27+
* @availability stack since=8.10.0 stability=stable
28+
* @availability serverless stability=stable visibility=public
29+
*/
30+
export interface Request extends RequestBase {
31+
path_parts: {
32+
/**
33+
* The unique identifier of the query ruleset to be created or updated
34+
*/
35+
ruleset_id: Id
36+
}
37+
/**
38+
* The criteria we're testing for
39+
*/
40+
/** @codegen_name match_criteria */
41+
body: {
42+
match_criteria: Dictionary<string, UserDefinedValue>
43+
}
44+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { integer } from '@_types/Numeric'
21+
import { QueryRulesetMatchedRule } from './types'
22+
23+
export class Response {
24+
body: {
25+
total_matched_rules: integer,
26+
matched_rules: QueryRulesetMatchedRule[]
27+
}
28+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
import { Dictionary } from '@spec_utils/Dictionary'
20+
import { Id } from '@_types/common'
21+
import { integer } from '@_types/Numeric'
22+
23+
export class QueryRulesetMatchedRule {
24+
/**
25+
* Ruleset unique identifier
26+
*/
27+
ruleset_id: Id
28+
/**
29+
* Rule unique identifier within that ruleset
30+
*/
31+
rule_id: Id
32+
}

0 commit comments

Comments
 (0)