Skip to content
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
130 changes: 83 additions & 47 deletions docs/reference/api-reference.md

Large diffs are not rendered by default.

165 changes: 165 additions & 0 deletions src/api/api/indices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,20 @@ export default class Indices {
body: [],
query: []
},
'indices.get_sample': {
path: [
'index'
],
body: [],
query: []
},
'indices.get_sample_stats': {
path: [
'index'
],
body: [],
query: []
},
'indices.get_settings': {
path: [
'index',
Expand Down Expand Up @@ -686,6 +700,13 @@ export default class Indices {
'write_index_only'
]
},
'indices.put_sample_configuration': {
path: [
'index'
],
body: [],
query: []
},
'indices.put_settings': {
path: [
'index'
Expand Down Expand Up @@ -3124,6 +3145,102 @@ export default class Indices {
return await this.transport.request({ path, method, querystring, body, meta }, options)
}

/**
* Get random sample of ingested data
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-get-sample | Elasticsearch API documentation}
*/
async getSample (this: That, params?: T.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
async getSample (this: That, params?: T.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
async getSample (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise<T.TODO>
async getSample (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise<any> {
const {
path: acceptedPath
} = this[kAcceptedParams]['indices.get_sample']

const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

let body: Record<string, any> | string | undefined
const userBody = params?.body
if (userBody != null) {
if (typeof userBody === 'string') {
body = userBody
} else {
body = { ...userBody }
}
}

params = params ?? {}
for (const key in params) {
if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
querystring[key] = params[key]
}
}

const method = 'GET'
const path = `/${encodeURIComponent(params.index.toString())}/_sample`
const meta: TransportRequestMetadata = {
name: 'indices.get_sample',
pathParts: {
index: params.index
},
acceptedParams: [
'index'
]
}
return await this.transport.request({ path, method, querystring, body, meta }, options)
}

/**
* Get stats about a random sample of ingested data
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-get-sample | Elasticsearch API documentation}
*/
async getSampleStats (this: That, params?: T.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
async getSampleStats (this: That, params?: T.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
async getSampleStats (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise<T.TODO>
async getSampleStats (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise<any> {
const {
path: acceptedPath
} = this[kAcceptedParams]['indices.get_sample_stats']

const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

let body: Record<string, any> | string | undefined
const userBody = params?.body
if (userBody != null) {
if (typeof userBody === 'string') {
body = userBody
} else {
body = { ...userBody }
}
}

params = params ?? {}
for (const key in params) {
if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
querystring[key] = params[key]
}
}

const method = 'GET'
const path = `/${encodeURIComponent(params.index.toString())}/_sample/stats`
const meta: TransportRequestMetadata = {
name: 'indices.get_sample_stats',
pathParts: {
index: params.index
},
acceptedParams: [
'index'
]
}
return await this.transport.request({ path, method, querystring, body, meta }, options)
}

/**
* Get index settings. Get setting information for one or more indices. For data streams, it returns setting information for the stream's backing indices.
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-get-settings | Elasticsearch API documentation}
Expand Down Expand Up @@ -3975,6 +4092,54 @@ export default class Indices {
return await this.transport.request({ path, method, querystring, body, meta }, options)
}

/**
* Configure sampling for an index or data stream
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-sample-configuration | Elasticsearch API documentation}
*/
async putSampleConfiguration (this: That, params?: T.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
async putSampleConfiguration (this: That, params?: T.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
async putSampleConfiguration (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise<T.TODO>
async putSampleConfiguration (this: That, params?: T.TODO, options?: TransportRequestOptions): Promise<any> {
const {
path: acceptedPath
} = this[kAcceptedParams]['indices.put_sample_configuration']

const userQuery = params?.querystring
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}

let body: Record<string, any> | string | undefined
const userBody = params?.body
if (userBody != null) {
if (typeof userBody === 'string') {
body = userBody
} else {
body = { ...userBody }
}
}

params = params ?? {}
for (const key in params) {
if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body' && key !== 'querystring') {
querystring[key] = params[key]
}
}

const method = 'PUT'
const path = `/${encodeURIComponent(params.index.toString())}/_sample/config`
const meta: TransportRequestMetadata = {
name: 'indices.put_sample_configuration',
pathParts: {
index: params.index
},
acceptedParams: [
'index'
]
}
return await this.transport.request({ path, method, querystring, body, meta }, options)
}

/**
* Update index settings. Changes dynamic index settings in real time. For data streams, index setting changes are applied to all backing indices by default. To revert a setting to the default value, use a null value. The list of per-index settings that can be updated dynamically on live indices can be found in index settings documentation. To preserve existing settings from being updated, set the `preserve_existing` parameter to `true`. For performance optimization during bulk indexing, you can disable the refresh interval. Refer to [disable refresh interval](https://www.elastic.co/docs/deploy-manage/production-guidance/optimize-performance/indexing-speed#disable-refresh-interval) for an example. There are multiple valid ways to represent index settings in the request body. You can specify only the setting, for example: ``` { "number_of_replicas": 1 } ``` Or you can use an `index` setting object: ``` { "index": { "number_of_replicas": 1 } } ``` Or you can use dot annotation: ``` { "index.number_of_replicas": 1 } ``` Or you can embed any of the aforementioned options in a `settings` object. For example: ``` { "settings": { "index": { "number_of_replicas": 1 } } } ``` NOTE: You can only define new analyzers on closed indices. To add an analyzer, you must close the index, define the analyzer, and reopen the index. You cannot close the write index of a data stream. To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. This affects searches and any new data added to the stream after the rollover. However, it does not affect the data stream's backing indices or their existing data. To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. Refer to [updating analyzers on existing indices](https://www.elastic.co/docs/manage-data/data-store/text-analysis/specify-an-analyzer#update-analyzers-on-existing-indices) for step-by-step examples.
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-settings | Elasticsearch API documentation}
Expand Down
10 changes: 7 additions & 3 deletions src/api/api/inference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,8 @@ export default class Inference {
body: [
'query',
'input',
'return_documents',
'top_n',
'task_settings'
],
query: [
Expand Down Expand Up @@ -488,7 +490,7 @@ export default class Inference {
}

/**
* Perform chat completion inference The chat completion inference API enables real-time responses for chat completion tasks by delivering answers incrementally, reducing response times during computation. It only works with the `chat_completion` task type for `openai` and `elastic` inference services. NOTE: The `chat_completion` task type is only available within the _stream API and only supports streaming. The Chat completion inference API and the Stream inference API differ in their response structure and capabilities. The Chat completion inference API provides more comprehensive customization options through more fields and function calling support. If you use the `openai`, `hugging_face` or the `elastic` service, use the Chat completion inference API.
* Perform chat completion inference on the service The chat completion inference API enables real-time responses for chat completion tasks by delivering answers incrementally, reducing response times during computation. It only works with the `chat_completion` task type for `openai` and `elastic` inference services. NOTE: The `chat_completion` task type is only available within the _stream API and only supports streaming. The Chat completion inference API and the Stream inference API differ in their response structure and capabilities. The Chat completion inference API provides more comprehensive customization options through more fields and function calling support. If you use the `openai`, `hugging_face` or the `elastic` service, use the Chat completion inference API.
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-unified-inference | Elasticsearch API documentation}
*/
async chatCompletionUnified (this: That, params: T.InferenceChatCompletionUnifiedRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.InferenceChatCompletionUnifiedResponse>
Expand Down Expand Up @@ -540,7 +542,7 @@ export default class Inference {
}

/**
* Perform completion inference on the service
* Perform completion inference on the service Get responses for completion tasks. This API works only with the completion task type. IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. This API requires the `monitor_inference` cluster privilege (the built-in `inference_admin` and `inference_user` roles grant this privilege).
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-inference | Elasticsearch API documentation}
*/
async completion (this: That, params: T.InferenceCompletionRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.InferenceCompletionResponse>
Expand Down Expand Up @@ -2378,6 +2380,8 @@ export default class Inference {
'inference_id',
'query',
'input',
'return_documents',
'top_n',
'task_settings',
'timeout'
]
Expand Down Expand Up @@ -2449,7 +2453,7 @@ export default class Inference {
}

/**
* Perform streaming inference. Get real-time responses for completion tasks by delivering answers incrementally, reducing response times during computation. This API works only with the completion task type. IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. This API requires the `monitor_inference` cluster privilege (the built-in `inference_admin` and `inference_user` roles grant this privilege). You must use a client that supports streaming.
* Perform streaming completion inference on the service Get real-time responses for completion tasks by delivering answers incrementally, reducing response times during computation. This API works only with the completion task type. IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. This API requires the `monitor_inference` cluster privilege (the built-in `inference_admin` and `inference_user` roles grant this privilege). You must use a client that supports streaming.
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-stream-inference | Elasticsearch API documentation}
*/
async streamCompletion (this: That, params: T.InferenceStreamCompletionRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.InferenceStreamCompletionResponse>
Expand Down
3 changes: 2 additions & 1 deletion src/api/api/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ export default class Project {
}

/**
* Return tags defined for the project
* Get tags. Get the tags that are defined for the project.
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch-serverless/operation/operation-project-tags | Elasticsearch API documentation}
*/
async tags (this: That, params?: T.ProjectTagsRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.ProjectTagsResponse>
async tags (this: That, params?: T.ProjectTagsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ProjectTagsResponse, unknown>>
Expand Down
2 changes: 0 additions & 2 deletions src/api/api/reindex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ const acceptedParams: Record<string, { path: string[], body: string[], query: st
'dest',
'max_docs',
'script',
'size',
'source'
],
query: [
Expand Down Expand Up @@ -108,7 +107,6 @@ export default async function ReindexApi (this: That, params: T.ReindexRequest,
'dest',
'max_docs',
'script',
'size',
'source',
'refresh',
'requests_per_second',
Expand Down
12 changes: 8 additions & 4 deletions src/api/api/security.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ export default class Security {
'access',
'expiration',
'metadata',
'name'
'name',
'certificate_identity'
],
query: []
},
Expand Down Expand Up @@ -636,7 +637,8 @@ export default class Security {
body: [
'access',
'expiration',
'metadata'
'metadata',
'certificate_identity'
],
query: []
},
Expand Down Expand Up @@ -1382,7 +1384,8 @@ export default class Security {
'access',
'expiration',
'metadata',
'name'
'name',
'certificate_identity'
]
}
return await this.transport.request({ path, method, querystring, body, meta }, options)
Expand Down Expand Up @@ -4198,7 +4201,8 @@ export default class Security {
'id',
'access',
'expiration',
'metadata'
'metadata',
'certificate_identity'
]
}
return await this.transport.request({ path, method, querystring, body, meta }, options)
Expand Down
Loading
Loading