Skip to content

Commit

Permalink
Auto-generated code for main (#2015)
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Sep 21, 2023
1 parent 59caa7b commit 10f7ba7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
4 changes: 2 additions & 2 deletions docs/reference.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -7020,15 +7020,15 @@ Creates or updates a query ruleset.
{ref}/put-query-ruleset.html[Endpoint documentation]
[source,ts]
----
client.queryRuleset.put({ ruleset_id })
client.queryRuleset.put({ ruleset_id, rules })
----

[discrete]
==== Arguments

* *Request (object):*
** *`ruleset_id` (string)*: The unique identifier of the query ruleset to be created or updated
** *`query_ruleset` (Optional, { ruleset_id, rules })*
** *`rules` ({ rule_id, type, criteria, actions }[])*

[discrete]
=== rollup
Expand Down
13 changes: 10 additions & 3 deletions src/api/api/query_ruleset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,22 @@ export default class QueryRuleset {
async put (this: That, params: T.QueryRulesetPutRequest | TB.QueryRulesetPutRequest, options?: TransportRequestOptions): Promise<T.QueryRulesetPutResponse>
async put (this: That, params: T.QueryRulesetPutRequest | TB.QueryRulesetPutRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['ruleset_id']
const acceptedBody: string[] = ['query_ruleset']
const acceptedBody: string[] = ['rules']
const querystring: Record<string, any> = {}
// @ts-expect-error
let body: any = params.body ?? undefined
const userBody: any = params?.body
let body: Record<string, any> | string
if (typeof userBody === 'string') {
body = userBody
} else {
body = userBody != null ? { ...userBody } : undefined
}

for (const key in params) {
if (acceptedBody.includes(key)) {
body = body ?? {}
// @ts-expect-error
body = params[key]
body[key] = params[key]
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body') {
Expand Down
8 changes: 4 additions & 4 deletions src/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3240,8 +3240,8 @@ export type AggregationsFrequentItemSetsBucket = AggregationsFrequentItemSetsBuc

export interface AggregationsFrequentItemSetsField {
field: Field
exclude?: string | string[]
include?: string | string[]
exclude?: AggregationsTermsExclude
include?: AggregationsTermsInclude
}

export type AggregationsGapPolicy = 'skip' | 'insert_zeros' | 'keep_values'
Expand Down Expand Up @@ -3856,7 +3856,7 @@ export interface AggregationsSignificantTextAggregation extends AggregationsBuck
field?: Field
filter_duplicate_text?: boolean
gnd?: AggregationsGoogleNormalizedDistanceHeuristic
include?: string | string[]
include?: AggregationsTermsInclude
jlh?: EmptyObject
min_doc_count?: long
mutual_information?: AggregationsMutualInformationHeuristic
Expand Down Expand Up @@ -15279,7 +15279,7 @@ export interface QueryRulesetListResponse {

export interface QueryRulesetPutRequest extends RequestBase {
ruleset_id: Id
query_ruleset?: QueryRulesetQueryRuleset
rules: QueryRulesetQueryRule[]
}

export interface QueryRulesetPutResponse {
Expand Down
12 changes: 7 additions & 5 deletions src/api/typesWithBodyKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3313,8 +3313,8 @@ export type AggregationsFrequentItemSetsBucket = AggregationsFrequentItemSetsBuc

export interface AggregationsFrequentItemSetsField {
field: Field
exclude?: string | string[]
include?: string | string[]
exclude?: AggregationsTermsExclude
include?: AggregationsTermsInclude
}

export type AggregationsGapPolicy = 'skip' | 'insert_zeros' | 'keep_values'
Expand Down Expand Up @@ -3929,7 +3929,7 @@ export interface AggregationsSignificantTextAggregation extends AggregationsBuck
field?: Field
filter_duplicate_text?: boolean
gnd?: AggregationsGoogleNormalizedDistanceHeuristic
include?: string | string[]
include?: AggregationsTermsInclude
jlh?: EmptyObject
min_doc_count?: long
mutual_information?: AggregationsMutualInformationHeuristic
Expand Down Expand Up @@ -15574,8 +15574,10 @@ export interface QueryRulesetListResponse {

export interface QueryRulesetPutRequest extends RequestBase {
ruleset_id: Id
/** @deprecated The use of the 'body' key has been deprecated, use 'query_ruleset' instead. */
body?: QueryRulesetQueryRuleset
/** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */
body?: {
rules: QueryRulesetQueryRule[]
}
}

export interface QueryRulesetPutResponse {
Expand Down

0 comments on commit 10f7ba7

Please sign in to comment.