Skip to content

Validate indices.put_index_template #388

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 3 commits into from
Apr 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
196 changes: 193 additions & 3 deletions output/schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4752,10 +4752,17 @@
"description": "Creates or updates an index template.",
"docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html",
"name": "indices.put_index_template",
"request": null,
"request": {
"name": "Request",
"namespace": "indices.put_index_template"
},
"requestBodyRequired": true,
"response": null,
"stability": "stable",
"response": {
"name": "Response",
"namespace": "indices.put_index_template"
},
"since": "7.9.0",
"stability": "TODO",
"urls": [
{
"methods": [
Expand Down Expand Up @@ -87323,6 +87330,189 @@
},
"properties": []
},
{
"kind": "interface",
"name": {
"name": "IndexTemplateMapping",
"namespace": "indices.put_index_template"
},
"properties": [
{
"name": "aliases",
"required": false,
"type": {
"key": {
"kind": "instance_of",
"type": {
"name": "IndexName",
"namespace": "_types"
}
},
"kind": "dictionary_of",
"singleKey": false,
"value": {
"kind": "instance_of",
"type": {
"name": "Alias",
"namespace": "indices._types"
}
}
}
},
{
"name": "mappings",
"required": false,
"type": {
"kind": "instance_of",
"type": {
"name": "TypeMapping",
"namespace": "_types.mapping"
}
}
},
{
"name": "settings",
"required": false,
"type": {
"kind": "instance_of",
"type": {
"name": "IndexSettings",
"namespace": "_types.index"
}
}
}
]
},
{
"attachedBehaviors": [
"CommonQueryParameters"
],
"body": {
"kind": "properties",
"properties": [
{
"name": "index_patterns",
"required": false,
"type": {
"kind": "instance_of",
"type": {
"name": "Indices",
"namespace": "_types"
}
}
},
{
"name": "composed_of",
"required": false,
"type": {
"kind": "array_of",
"value": {
"kind": "instance_of",
"type": {
"name": "Name",
"namespace": "_types"
}
}
}
},
{
"name": "template",
"required": false,
"type": {
"kind": "instance_of",
"type": {
"name": "IndexTemplateMapping",
"namespace": "indices.put_index_template"
}
}
},
{
"name": "data_stream",
"required": false,
"type": {
"kind": "instance_of",
"type": {
"name": "EmptyObject",
"namespace": "_types"
}
}
},
{
"name": "priority",
"required": false,
"type": {
"kind": "instance_of",
"type": {
"name": "integer",
"namespace": "_types"
}
}
},
{
"name": "version",
"required": false,
"type": {
"kind": "instance_of",
"type": {
"name": "VersionNumber",
"namespace": "_types"
}
}
},
{
"name": "_meta",
"required": false,
"type": {
"kind": "instance_of",
"type": {
"name": "IndexMetaData",
"namespace": "_types"
}
}
}
]
},
"inherits": {
"type": {
"name": "RequestBase",
"namespace": "_types"
}
},
"kind": "request",
"name": {
"name": "Request",
"namespace": "indices.put_index_template"
},
"path": [
{
"description": "Index or template name",
"name": "name",
"required": true,
"type": {
"kind": "instance_of",
"type": {
"name": "Name",
"namespace": "_types"
}
}
}
],
"query": []
},
{
"inherits": {
"type": {
"name": "AcknowledgedResponseBase",
"namespace": "_types"
}
},
"kind": "interface",
"name": {
"name": "Response",
"namespace": "indices.put_index_template"
},
"properties": []
},
{
"attachedBehaviors": [
"CommonQueryParameters"
Expand Down
2 changes: 1 addition & 1 deletion output/schema/validation-errors.json
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@
},
"indices.put_index_template": {
"request": [
"Missing request & response"
"Endpoint has \"@stability: TODO"
],
"response": []
},
Expand Down
22 changes: 22 additions & 0 deletions output/typescript/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8705,6 +8705,28 @@ export interface IndicesPutAliasRequest extends RequestBase {
export interface IndicesPutAliasResponse extends ResponseBase {
}

export interface IndicesPutIndexTemplateIndexTemplateMapping {
aliases?: Record<IndexName, IndicesAlias>
mappings?: MappingTypeMapping
settings?: IndexIndexSettings
}

export interface IndicesPutIndexTemplateRequest extends RequestBase {
name: Name
body?: {
index_patterns?: Indices
composed_of?: Name[]
template?: IndicesPutIndexTemplateIndexTemplateMapping
data_stream?: EmptyObject
priority?: integer
version?: VersionNumber
_meta?: IndexMetaData
}
}

export interface IndicesPutIndexTemplateResponse extends AcknowledgedResponseBase {
}

export interface IndicesPutMappingRequest extends RequestBase {
index?: Indices
type?: Type
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* 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 { Alias } from '@indices/_types/Alias'
import { Dictionary } from '@spec_utils/Dictionary'
import { RequestBase } from '@_types/Base'
import {
EmptyObject,
IndexMetaData,
IndexName,
Indices,
Name,
VersionNumber
} from '@_types/common'
import { IndexSettings } from '@_types/index/IndexSettings'
import { TypeMapping } from '@_types/mapping/TypeMapping'
import { integer } from '@_types/Numeric'

/**
* @rest_spec_name indices.put_index_template
* @since 7.9.0
* @stability TODO
*/
export interface Request extends RequestBase {
path_parts: {
/** Index or template name */
name: Name
}
body?: {
index_patterns?: Indices
composed_of?: Name[]
template?: IndexTemplateMapping
data_stream?: EmptyObject
priority?: integer
version?: VersionNumber
_meta?: IndexMetaData
}
}

export class IndexTemplateMapping {
aliases?: Dictionary<IndexName, Alias>
mappings?: TypeMapping
settings?: IndexSettings
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* 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 extends AcknowledgedResponseBase {}