-
Notifications
You must be signed in to change notification settings - Fork 102
Add Query Rules API #2207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add Query Rules API #2207
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
58a8900
Initial commit adding query rules to clients
kderusso fdd8c0e
Add json specs; rename value -> values
kderusso b4cf3c2
Update values to optional user defined value, per generator errors
kderusso 99a6048
Prettier
kderusso 6fc43d0
Fix URL
kderusso 44eba6d
Rename folder
kderusso d83c8c3
PR feedback
kderusso 28f8256
Fixed container variants
kderusso 366ff23
Refactor QueryRulesetListItem into a types.ts file
kderusso 655f836
PR feedback - remove container from RuleQuery and add to query container
kderusso File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"query_ruleset.delete": { | ||
"documentation": { | ||
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-query-ruleset.html", | ||
"description": "Deletes a query ruleset." | ||
}, | ||
"stability": "experimental", | ||
"visibility": "public", | ||
"headers": { | ||
"accept": ["application/json"] | ||
}, | ||
"url": { | ||
"paths": [ | ||
{ | ||
"path": "/_query_rules/{ruleset_id}", | ||
"methods": ["DELETE"], | ||
"parts": { | ||
"ruleset_id": { | ||
"type": "string", | ||
"description": "The unique identifier of the query ruleset to delete" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"query_ruleset.get": { | ||
"documentation": { | ||
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/get-query-ruleset.html", | ||
"description": "Returns the details about a query ruleset." | ||
}, | ||
"stability": "experimental", | ||
"visibility": "public", | ||
"headers": { | ||
"accept": ["application/json"] | ||
}, | ||
"url": { | ||
"paths": [ | ||
{ | ||
"path": "/_query_rules/{ruleset_id}", | ||
"methods": ["GET"], | ||
"parts": { | ||
"ruleset_id": { | ||
"type": "string", | ||
"description": "The unique identifier of the query ruleset" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"query_ruleset.list": { | ||
"documentation": { | ||
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/list-query-rulesets.html", | ||
"description": "Lists query rulesets." | ||
}, | ||
"stability": "experimental", | ||
"visibility": "public", | ||
"headers": { | ||
"accept": ["application/json"] | ||
}, | ||
"url": { | ||
"paths": [ | ||
{ | ||
"path": "/_query_rules", | ||
"methods": ["GET"] | ||
} | ||
] | ||
}, | ||
"params": { | ||
"from": { | ||
"type": "int", | ||
"default": 0, | ||
"description": "Starting offset (default: 0)" | ||
}, | ||
"size": { | ||
"type": "int", | ||
"default": 100, | ||
"description": "specifies a max number of results to get (default: 100)" | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"query_ruleset.put": { | ||
"documentation": { | ||
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/put-query-ruleset.html", | ||
"description": "Creates or updates a query ruleset." | ||
}, | ||
"stability": "experimental", | ||
"visibility": "public", | ||
"headers": { | ||
"accept": ["application/json"], | ||
"content_type": ["application/json"] | ||
}, | ||
"url": { | ||
"paths": [ | ||
{ | ||
"path": "/_query_rules/{ruleset_id}", | ||
"methods": ["PUT"], | ||
"parts": { | ||
"ruleset_id": { | ||
"type": "string", | ||
"description": "The unique identifier of the ruleset to be created or updated." | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"body": { | ||
"description": "The query ruleset configuration, including `rules`", | ||
"required": true | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { Id, IndexName, Name } from '@_types/common' | ||
import { EpochTime, UnitMillis } from '@_types/Time' | ||
import { InlineScript } from '@_types/Scripting' | ||
import { UserDefinedValue } from '@spec_utils/UserDefinedValue' | ||
import { PinnedDoc } from '../../_types/query_dsl/specialized' | ||
|
||
export class QueryRuleset { | ||
/** | ||
* Query Ruleset unique identifier | ||
*/ | ||
ruleset_id: Id | ||
/** | ||
* Rules associated with the query ruleset | ||
*/ | ||
rules: QueryRule[] | ||
} | ||
|
||
export class QueryRule { | ||
rule_id: Id | ||
type: QueryRuleType | ||
criteria: QueryRuleCriteria[] | ||
actions: QueryRuleActions | ||
} | ||
|
||
export enum QueryRuleType { | ||
pinned | ||
} | ||
|
||
export class QueryRuleCriteria { | ||
type: QueryRuleCriteriaType | ||
metadata: string | ||
values?: UserDefinedValue[] | ||
} | ||
|
||
export enum QueryRuleCriteriaType { | ||
global, | ||
exact, | ||
exact_fuzzy, | ||
prefix, | ||
suffix, | ||
contains, | ||
lt, | ||
lte, | ||
gt, | ||
gte | ||
} | ||
|
||
export class QueryRuleActions { | ||
ids?: Id[] | ||
docs?: PinnedDoc[] | ||
} |
35 changes: 35 additions & 0 deletions
35
specification/query_ruleset/delete/QueryRulesetDeleteRequest.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
import { RequestBase } from '@_types/Base' | ||
import { Id } from '@_types/common' | ||
|
||
/** | ||
* Deletes a query ruleset. | ||
* @rest_spec_name query_ruleset.delete | ||
* @availability stack since=8.10.0 stability=experimental | ||
* @availability serverless stability=experimental visibility=public | ||
*/ | ||
interface Request extends RequestBase { | ||
path_parts: { | ||
/** | ||
* The unique identifier of the query ruleset to delete | ||
*/ | ||
ruleset_id: Id | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
specification/query_ruleset/delete/QueryRulesetDeleteResponse.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { AcknowledgedResponseBase } from '@_types/Base' | ||
|
||
export class Response { | ||
body: AcknowledgedResponseBase | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.