API generation

This commit is contained in:
delvedor
2021-05-12 17:38:05 +02:00
parent 7b87db49ae
commit 791f2168a3
5 changed files with 88 additions and 0 deletions

56
api/api/termsenum.js Normal file
View File

@ -0,0 +1,56 @@
/*
* 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.
*/
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path']
const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }
function termsenumApi (params, options, callback) {
;[params, options, callback] = normalizeArguments(params, options, callback)
// check required parameters
if (params.index == null) {
const err = new this[kConfigurationError]('Missing required parameter: index')
return handleError(err, callback)
}
let { method, body, index, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
let path = ''
if (method == null) method = body == null ? 'GET' : 'POST'
path = '/' + encodeURIComponent(index) + '/' + '_terms_enum'
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
return this.transport.request(request, options, callback)
}
module.exports = termsenumApi

View File

@ -84,6 +84,7 @@ const SnapshotApi = require('./api/snapshot')
const SqlApi = require('./api/sql')
const SslApi = require('./api/ssl')
const TasksApi = require('./api/tasks')
const termsenumApi = require('./api/termsenum')
const termvectorsApi = require('./api/termvectors')
const TextStructureApi = require('./api/text_structure')
const TransformApi = require('./api/transform')
@ -201,6 +202,7 @@ ESAPI.prototype.scroll = scrollApi
ESAPI.prototype.search = searchApi
ESAPI.prototype.searchShards = searchShardsApi
ESAPI.prototype.searchTemplate = searchTemplateApi
ESAPI.prototype.termsenum = termsenumApi
ESAPI.prototype.termvectors = termvectorsApi
ESAPI.prototype.update = updateApi
ESAPI.prototype.updateByQuery = updateByQueryApi

View File

@ -2509,6 +2509,11 @@ export interface TasksList extends Generic {
timeout?: string;
}
export interface Termsenum<T = RequestBody> extends Generic {
index: string | string[];
body?: T;
}
export interface Termvectors<T = RequestBody> extends Generic {
index: string;
id?: string;

View File

@ -10345,6 +10345,27 @@ _Default:_ `nodes`
|===
[discrete]
=== termsenum
*Stability:* beta
[source,ts]
----
client.termsenum({
index: string | string[],
body: object
})
----
link:{ref}/terms-enum.html[Documentation] +
[cols=2*]
|===
|`index`
|`string \| string[]` - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
|`body`
|`object` - field name, string which is the prefix expected in matching terms, timeout and size for max number of results
|===
[discrete]
=== termvectors

4
index.d.ts vendored
View File

@ -2561,6 +2561,10 @@ declare class Client {
list<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.TasksList, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
list<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.TasksList, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
}
termsenum<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.Termsenum<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
termsenum<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
termsenum<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.Termsenum<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
termsenum<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.Termsenum<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
termvectors<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.Termvectors<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
termvectors<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
termvectors<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.Termvectors<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback