Get behavioral analytics collections
Deprecated
Technical preview
curl \
--request GET 'http://api.example.com/_application/analytics' \
--header "Authorization: $API_KEY"
{
"my_analytics_collection": {
"event_data_stream": {
"name": "behavioral_analytics-events-my_analytics_collection"
}
},
"my_analytics_collection2": {
"event_data_stream": {
"name": "behavioral_analytics-events-my_analytics_collection2"
}
}
}
Get snapshot information
Added in 2.1.0
Get information about the snapshots stored in one or more repositories. A snapshot is a backup of an index or running Elasticsearch cluster. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get snapshot API.
Query parameters
-
h
string | array[string] List of columns to appear in the response. Supports simple wildcards.
-
s
string | array[string] List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting
:asc
or:desc
as a suffix to the column name. -
master_timeout
string Period to wait for a connection to the master node.
-
time
string Unit used to display time values.
Values are
nanos
,micros
,ms
,s
,m
,h
, ord
.
curl \
--request GET 'http://api.example.com/_cat/snapshots' \
--header "Authorization: $API_KEY"
[
{
"id": "snap1",
"repository": "repo1",
"status": "FAILED",
"start_epoch": "1445616705",
"start_time": "18:11:45",
"end_epoch": "1445616978",
"end_time": "18:16:18",
"duration": "4.6m",
"indices": "1",
"successful_shards": "4",
"failed_shards": "1",
"total_shards": "5"
},
{
"id": "snap2",
"repository": "repo1",
"status": "SUCCESS",
"start_epoch": "1445634298",
"start_time": "23:04:58",
"end_epoch": "1445634672",
"end_time": "23:11:12",
"duration": "6.2m",
"indices": "2",
"successful_shards": "10",
"failed_shards": "0",
"total_shards": "10"
}
]
Get snapshot information
Added in 2.1.0
Get information about the snapshots stored in one or more repositories. A snapshot is a backup of an index or running Elasticsearch cluster. IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get snapshot API.
Path parameters
-
repository
string | array[string] Required A comma-separated list of snapshot repositories used to limit the request. Accepts wildcard expressions.
_all
returns all repositories. If any repository fails during the request, Elasticsearch returns an error.
Query parameters
-
h
string | array[string] List of columns to appear in the response. Supports simple wildcards.
-
s
string | array[string] List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting
:asc
or:desc
as a suffix to the column name. -
master_timeout
string Period to wait for a connection to the master node.
-
time
string Unit used to display time values.
Values are
nanos
,micros
,ms
,s
,m
,h
, ord
.
curl \
--request GET 'http://api.example.com/_cat/snapshots/{repository}' \
--header "Authorization: $API_KEY"
[
{
"id": "snap1",
"repository": "repo1",
"status": "FAILED",
"start_epoch": "1445616705",
"start_time": "18:11:45",
"end_epoch": "1445616978",
"end_time": "18:16:18",
"duration": "4.6m",
"indices": "1",
"successful_shards": "4",
"failed_shards": "1",
"total_shards": "5"
},
{
"id": "snap2",
"repository": "repo1",
"status": "SUCCESS",
"start_epoch": "1445634298",
"start_time": "23:04:58",
"end_epoch": "1445634672",
"end_time": "23:11:12",
"duration": "6.2m",
"indices": "2",
"successful_shards": "10",
"failed_shards": "0",
"total_shards": "10"
}
]
Clear cluster voting config exclusions
Added in 7.0.0
Remove master-eligible nodes from the voting configuration exclusion list.
Query parameters
-
master_timeout
string Period to wait for a connection to the master node.
-
wait_for_removal
boolean Specifies whether to wait for all excluded nodes to be removed from the cluster before clearing the voting configuration exclusions list. Defaults to true, meaning that all excluded nodes must be removed from the cluster before this API takes any action. If set to false then the voting configuration exclusions list is cleared even if some excluded nodes are still in the cluster.
curl \
--request DELETE 'http://api.example.com/_cluster/voting_config_exclusions' \
--header "Authorization: $API_KEY"
Update the cluster settings
Configure and update dynamic settings on a running cluster.
You can also configure dynamic settings locally on an unstarted or shut down node in elasticsearch.yml
.
Updates made with this API can be persistent, which apply across cluster restarts, or transient, which reset after a cluster restart. You can also reset transient or persistent settings by assigning them a null value.
If you configure the same setting using multiple methods, Elasticsearch applies the settings in following order of precedence: 1) Transient setting; 2) Persistent setting; 3) elasticsearch.yml
setting; 4) Default setting value.
For example, you can apply a transient setting to override a persistent setting or elasticsearch.yml
setting.
However, a change to an elasticsearch.yml
setting will not override a defined transient or persistent setting.
TIP: In Elastic Cloud, use the user settings feature to configure all cluster settings. This method automatically rejects unsafe settings that could break your cluster.
If you run Elasticsearch on your own hardware, use this API to configure dynamic cluster settings.
Only use elasticsearch.yml
for static cluster settings and node settings.
The API doesn’t require a restart and ensures a setting’s value is the same on all nodes.
WARNING: Transient cluster settings are no longer recommended. Use persistent cluster settings instead. If a cluster becomes unstable, transient settings can clear unexpectedly, resulting in a potentially undesired cluster configuration.
Query parameters
-
flat_settings
boolean Return settings in flat format (default: false)
-
master_timeout
string Explicit operation timeout for connection to master node
-
timeout
string Explicit operation timeout
Body
Required
-
persistent
object -
transient
object
curl \
--request PUT 'http://api.example.com/_cluster/settings' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '"{\n \"persistent\" : {\n \"indices.recovery.max_bytes_per_sec\" : \"50mb\"\n }\n}"'
{
"persistent" : {
"indices.recovery.max_bytes_per_sec" : "50mb"
}
}
{
"persistent": {
"action.auto_create_index": "my-index-000001,index10,-index1*,+ind*"
}
}
{
"acknowledged": true,
"persistent": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"transient": {
"additionalProperty1": {},
"additionalProperty2": {}
}
}
Reload the keystore on nodes in the cluster
Added in 6.5.0
Secure settings are stored in an on-disk keystore. Certain of these settings are reloadable. That is, you can change them on disk and reload them without restarting any nodes in the cluster. When you have updated reloadable secure settings in your keystore, you can use this API to reload those settings on each node.
When the Elasticsearch keystore is password protected and not simply obfuscated, you must provide the password for the keystore when you reload the secure settings. Reloading the settings for the whole cluster assumes that the keystores for all nodes are protected with the same password; this method is allowed only when inter-node communications are encrypted. Alternatively, you can reload the secure settings on each node by locally accessing the API and passing the node-specific Elasticsearch keystore password.
Path parameters
-
node_id
string | array[string] Required The names of particular nodes in the cluster to target.
Query parameters
-
timeout
string Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.
Body
-
secure_settings_password
string
curl \
--request POST 'http://api.example.com/_nodes/{node_id}/reload_secure_settings' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '"{\n \"secure_settings_password\": \"keystore-password\"\n}"'
{
"secure_settings_password": "keystore-password"
}
{
"_nodes": {
"total": 1,
"successful": 1,
"failed": 0
},
"cluster_name": "my_cluster",
"nodes": {
"pQHNt5rXTTWNvUgOrdynKg": {
"name": "node-0"
}
}
}
Update the connector last sync stats
Technical preview
Update the fields related to the last sync of a connector. This action is used for analytics and monitoring.
Path parameters
-
connector_id
string Required The unique identifier of the connector to be updated
Body
Required
last_access_control_sync_scheduled_at
string | number A date and time, either as a string whose format can depend on the context (defaulting to ISO 8601), or a number of milliseconds since the Epoch. Elasticsearch accepts both as input, but will generally output a string representation.
-
Values are
canceling
,canceled
,completed
,error
,in_progress
,pending
, orsuspended
. -
last_deleted_document_count
number last_incremental_sync_scheduled_at
string | number A date and time, either as a string whose format can depend on the context (defaulting to ISO 8601), or a number of milliseconds since the Epoch. Elasticsearch accepts both as input, but will generally output a string representation.
-
last_indexed_document_count
number last_seen
string | number A date and time, either as a string whose format can depend on the context (defaulting to ISO 8601), or a number of milliseconds since the Epoch. Elasticsearch accepts both as input, but will generally output a string representation.
-
last_sync_error
string last_sync_scheduled_at
string | number A date and time, either as a string whose format can depend on the context (defaulting to ISO 8601), or a number of milliseconds since the Epoch. Elasticsearch accepts both as input, but will generally output a string representation.
-
last_sync_status
string Values are
canceling
,canceled
,completed
,error
,in_progress
,pending
, orsuspended
. last_synced
string | number A date and time, either as a string whose format can depend on the context (defaulting to ISO 8601), or a number of milliseconds since the Epoch. Elasticsearch accepts both as input, but will generally output a string representation.
-
sync_cursor
object
curl \
--request PUT 'http://api.example.com/_connector/{connector_id}/_last_sync' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '"{\n \"last_access_control_sync_error\": \"Houston, we have a problem!\",\n \"last_access_control_sync_scheduled_at\": \"2023-11-09T15:13:08.231Z\",\n \"last_access_control_sync_status\": \"pending\",\n \"last_deleted_document_count\": 42,\n \"last_incremental_sync_scheduled_at\": \"2023-11-09T15:13:08.231Z\",\n \"last_indexed_document_count\": 42,\n \"last_sync_error\": \"Houston, we have a problem!\",\n \"last_sync_scheduled_at\": \"2024-11-09T15:13:08.231Z\",\n \"last_sync_status\": \"completed\",\n \"last_synced\": \"2024-11-09T15:13:08.231Z\"\n}"'
{
"last_access_control_sync_error": "Houston, we have a problem!",
"last_access_control_sync_scheduled_at": "2023-11-09T15:13:08.231Z",
"last_access_control_sync_status": "pending",
"last_deleted_document_count": 42,
"last_incremental_sync_scheduled_at": "2023-11-09T15:13:08.231Z",
"last_indexed_document_count": 42,
"last_sync_error": "Houston, we have a problem!",
"last_sync_scheduled_at": "2024-11-09T15:13:08.231Z",
"last_sync_status": "completed",
"last_synced": "2024-11-09T15:13:08.231Z"
}
{
"result": "created"
}
Update the connector features
Technical preview
Update the connector features in the connector document. This API can be used to control the following aspects of a connector:
- document-level security
- incremental syncs
- advanced sync rules
- basic sync rules
Normally, the running connector service automatically manages these features. However, you can use this API to override the default behavior.
To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. This service runs automatically on Elastic Cloud for Elastic managed connectors.
Path parameters
-
connector_id
string Required The unique identifier of the connector to be updated.
curl \
--request PUT 'http://api.example.com/_connector/{connector_id}/_features' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '"{\n \"features\": {\n \"document_level_security\": {\n \"enabled\": true\n },\n \"incremental_sync\": {\n \"enabled\": true\n },\n \"sync_rules\": {\n \"advanced\": {\n \"enabled\": false\n },\n \"basic\": {\n \"enabled\": true\n }\n }\n }\n}"'
{
"features": {
"document_level_security": {
"enabled": true
},
"incremental_sync": {
"enabled": true
},
"sync_rules": {
"advanced": {
"enabled": false
},
"basic": {
"enabled": true
}
}
}
}
{
"features": {
"document_level_security": {
"enabled": true
}
}
}
{
"result": "updated"
}
Update the connector name and description
Beta
Path parameters
-
connector_id
string Required The unique identifier of the connector to be updated
Body
Required
-
name
string -
description
string
curl \
--request PUT 'http://api.example.com/_connector/{connector_id}/_name' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '"{\n \"name\": \"Custom connector\",\n \"description\": \"This is my customized connector\"\n}"'
{
"name": "Custom connector",
"description": "This is my customized connector"
}
{
"result": "updated"
}
Get global checkpoints
Added in 7.13.0
Get the current global checkpoints for an index. This API is designed for internal use by the Fleet server project.
Path parameters
-
index
string Required A single index or index alias that resolves to a single index.
Query parameters
-
wait_for_advance
boolean A boolean value which controls whether to wait (until the timeout) for the global checkpoints to advance past the provided
checkpoints
. -
wait_for_index
boolean A boolean value which controls whether to wait (until the timeout) for the target index to exist and all primary shards be active. Can only be true when
wait_for_advance
is true. -
checkpoints
array[number] A comma separated list of previous global checkpoints. When used in combination with
wait_for_advance
, the API will only return once the global checkpoints advances past the checkpoints. Providing an empty list will cause Elasticsearch to immediately return the current global checkpoints. -
timeout
string Period to wait for a global checkpoints to advance past
checkpoints
.
curl \
--request GET 'http://api.example.com/{index}/_fleet/global_checkpoints' \
--header "Authorization: $API_KEY"
{
"global_checkpoints": [
42.0
],
"timed_out": true
}
Create or update an index template
Index templates define settings, mappings, and aliases that can be applied automatically to new indices. Elasticsearch applies templates to new indices based on an index pattern that matches the index name.
IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8.
Composable templates always take precedence over legacy templates. If no composable template matches a new index, matching legacy templates are applied according to their order.
Index templates are only applied during index creation. Changes to index templates do not affect existing indices. Settings and mappings specified in create index API requests override any settings or mappings specified in an index template.
You can use C-style /* *\/
block comments in index templates.
You can include comments anywhere in the request body, except before the opening curly bracket.
Indices matching multiple templates
Multiple index templates can potentially match an index, in this case, both the settings and mappings are merged into the final configuration of the index. The order of the merging can be controlled using the order parameter, with lower order being applied first, and higher orders overriding them. NOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order.
Path parameters
-
name
string Required The name of the template
Query parameters
-
create
boolean If true, this request cannot replace or update existing index templates.
-
master_timeout
string Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.
-
order
number Order in which Elasticsearch applies this template if index matches multiple templates.
Templates with lower 'order' values are merged first. Templates with higher 'order' values are merged later, overriding templates with lower values.
-
cause
string User defined reason for creating/updating the index template
Body
Required
-
aliases
object Aliases for the index.
index_patterns
string | array[string] Array of wildcard expressions used to match the names of indices during creation.
-
mappings
object -
order
number Order in which Elasticsearch applies this template if index matches multiple templates.
Templates with lower 'order' values are merged first. Templates with higher 'order' values are merged later, overriding templates with lower values.
-
settings
object -
version
number
curl \
--request PUT 'http://api.example.com/_template/{name}' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '"{\n \"index_patterns\": [\n \"te*\",\n \"bar*\"\n ],\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"mappings\": {\n \"_source\": {\n \"enabled\": false\n }\n },\n \"properties\": {\n \"host_name\": {\n \"type\": \"keyword\"\n },\n \"created_at\": {\n \"type\": \"date\",\n \"format\": \"EEE MMM dd HH:mm:ss Z yyyy\"\n }\n }\n}"'
{
"index_patterns": [
"te*",
"bar*"
],
"settings": {
"number_of_shards": 1
},
"mappings": {
"_source": {
"enabled": false
}
},
"properties": {
"host_name": {
"type": "keyword"
},
"created_at": {
"type": "date",
"format": "EEE MMM dd HH:mm:ss Z yyyy"
}
}
}
{
"index_patterns": [
"te*"
],
"settings": {
"number_of_shards": 1
},
"aliases": {
"alias1": {},
"alias2": {
"filter": {
"term": {
"user.id": "kimchy"
}
},
"routing": "shard-1"
},
"{index}-alias": {}
}
}
{
"acknowledged": true
}
Get index templates
Added in 7.9.0
Get information about one or more index templates.
Query parameters
-
local
boolean If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node.
-
flat_settings
boolean If true, returns settings in flat format.
-
master_timeout
string Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.
-
include_defaults
boolean If true, returns all relevant default configurations for the index template.
curl \
--request GET 'http://api.example.com/_index_template' \
--header "Authorization: $API_KEY"
{
"index_templates": [
{
"name": "string",
"index_template": {
"index_patterns": "string",
"composed_of": [
"string"
],
"template": {
"aliases": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"mappings": {
"all_field": {},
"date_detection": true,
"dynamic": "strict",
"dynamic_date_formats": [
"string"
],
"dynamic_templates": [
{}
],
"_field_names": {},
"index_field": {},
"_meta": {},
"numeric_detection": true,
"properties": {},
"_routing": {},
"_size": {},
"_source": {},
"runtime": {},
"enabled": true,
"subobjects": "true",
"_data_stream_timestamp": {}
},
"settings": {
"index": {},
"mode": "string",
"soft_deletes": {},
"sort": {},
"number_of_routing_shards": 42.0,
"check_on_startup": "true",
"codec": "string",
"load_fixed_bitset_filters_eagerly": true,
"merge": {},
"search": {},
"refresh_interval": "string",
"max_result_window": 42.0,
"max_inner_result_window": 42.0,
"max_rescore_window": 42.0,
"max_docvalue_fields_search": 42.0,
"max_script_fields": 42.0,
"max_ngram_diff": 42.0,
"max_shingle_diff": 42.0,
"blocks": {},
"max_refresh_listeners": 42.0,
"analyze": {},
"highlight": {},
"max_terms_count": 42.0,
"max_regex_length": 42.0,
"routing": {},
"gc_deletes": "string",
"default_pipeline": "string",
"final_pipeline": "string",
"lifecycle": {},
"provided_name": "string",
"uuid": "string",
"version": {},
"max_slices_per_scroll": 42.0,
"translog": {},
"query_string": {},
"top_metrics_max_size": 42.0,
"analysis": {},
"settings": {},
"time_series": {},
"queries": {},
"similarity": {},
"mapping": {},
"indexing.slowlog": {},
"indexing_pressure": {},
"store": {}
},
"": {}
},
"version": 42.0,
"priority": 42.0,
"_meta": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"allow_auto_create": true,
"data_stream": {
"hidden": true,
"allow_custom_routing": true
},
"deprecated": true,
"ignore_missing_component_templates": "string"
}
}
]
}
Get index shard stores
Get store information about replica shards in one or more indices. For data streams, the API retrieves store information for the stream's backing indices.
The index shard stores API returns the following information:
- The node on which each replica shard exists.
- The allocation ID for each replica shard.
- A unique ID for each replica shard.
- Any errors encountered while opening the shard index or from an earlier failure.
By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards.
Query parameters
-
allow_no_indices
boolean If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices.
-
expand_wildcards
string | array[string] Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.
-
status
string | array[string] List of shard health statuses used to limit the request.
curl \
--request GET 'http://api.example.com/_shard_stores' \
--header "Authorization: $API_KEY"
{
"indices": {
"my-index-000001": {
"shards": {
"0": {
"stores": [
{
"sPa3OgxLSYGvQ4oPs-Tajw": {
"name": "node_t0",
"ephemeral_id": "9NlXRFGCT1m8tkvYCMK-8A",
"transport_address": "local[1]",
"external_id": "node_t0",
"attributes": {},
"roles": [],
"version": "8.10.0",
"min_index_version": 7000099,
"max_index_version": 8100099
},
"allocation_id": "2iNySv_OQVePRX-yaRH_lQ",
"allocation": "primary",
"store_exception": {}
}
]
}
}
}
}
}
Query parameters
-
master_timeout
string Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.
-
timeout
string Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.
curl \
--request POST 'http://api.example.com/_aliases' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '{"actions":[{"add":{"alias":"string","aliases":"string","filter":{},"index":"string","indices":"string","index_routing":"string","is_hidden":true,"is_write_index":true,"routing":"string","search_routing":"string","must_exist":true},"remove":{"alias":"string","aliases":"string","index":"string","indices":"string","must_exist":true},"remove_index":{"index":"string","indices":"string","must_exist":true}}]}'
{
"actions": [
{
"add": {
"alias": "string",
"aliases": "string",
"filter": {},
"index": "string",
"indices": "string",
"index_routing": "string",
"is_hidden": true,
"is_write_index": true,
"routing": "string",
"search_routing": "string",
"must_exist": true
},
"remove": {
"alias": "string",
"aliases": "string",
"index": "string",
"indices": "string",
"must_exist": true
},
"remove_index": {
"index": "string",
"indices": "string",
"must_exist": true
}
}
]
}
{
"acknowledged": true
}
Migrate to data tiers routing
Added in 7.14.0
Switch the indices, ILM policies, and legacy, composable, and component templates from using custom node attributes and attribute-based allocation filters to using data tiers. Optionally, delete one legacy index template. Using node roles enables ILM to automatically move the indices between data tiers.
Migrating away from custom node attributes routing can be manually performed. This API provides an automated way of performing three out of the four manual steps listed in the migration guide:
- Stop setting the custom hot attribute on new indices.
- Remove custom allocation settings from existing ILM policies.
- Replace custom allocation settings from existing indices with the corresponding tier preference.
ILM must be stopped before performing the migration.
Use the stop ILM and get ILM status APIs to wait until the reported operation mode is STOPPED
.
Query parameters
-
dry_run
boolean If true, simulates the migration from node attributes based allocation filters to data tiers, but does not perform the migration. This provides a way to retrieve the indices and ILM policies that need to be migrated.
-
master_timeout
string The period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. It can also be set to
-1
to indicate that the request should never timeout.
Body
-
legacy_template_to_delete
string -
node_attribute
string
curl \
--request POST 'http://api.example.com/_ilm/migrate_to_data_tiers' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '"{\n \"legacy_template_to_delete\": \"global-template\",\n \"node_attribute\": \"custom_attribute_name\"\n}"'
{
"legacy_template_to_delete": "global-template",
"node_attribute": "custom_attribute_name"
}
{
"dry_run": false,
"removed_legacy_template":"global-template",
"migrated_ilm_policies":["policy_with_allocate_action"],
"migrated_indices":["warm-index-to-migrate-000001"],
"migrated_legacy_templates":["a-legacy-template"],
"migrated_composable_templates":["a-composable-template"],
"migrated_component_templates":["a-component-template"]
}
Perform inference on the service
Added in 8.11.0
This API enables you to use machine learning models to perform specific tasks on data that you provide as an input. It returns a response with the results of the tasks. The inference endpoint you use can perform one specific task that has been defined when the endpoint was created with the create inference API.
For details about using this API with a service, such as Amazon Bedrock, Anthropic, or HuggingFace, refer to the service-specific documentation.
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.
Path parameters
-
task_type
string Required The type of inference task that the model performs.
Values are
sparse_embedding
,text_embedding
,rerank
,completion
, orchat_completion
. -
inference_id
string Required The unique identifier for the inference endpoint.
Query parameters
-
timeout
string The amount of time to wait for the inference request to complete.
Body
-
query
string The query input, which is required only for the
rerank
task. It is not required for other tasks. input
string | array[string] Required The text on which you want to perform the inference task. It can be a single string or an array.
Inference endpoints for the
completion
task type currently only support a single string as input.-
task_settings
object
curl \
--request POST 'http://api.example.com/_inference/{task_type}/{inference_id}' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '{"query":"string","input":"string","task_settings":{}}'
{
"query": "string",
"input": "string",
"task_settings": {}
}
{
"text_embedding_bytes": [
{
"embedding": [
42.0
]
}
],
"text_embedding_bits": [
{
"embedding": [
42.0
]
}
],
"text_embedding": [
{
"embedding": [
42.0
]
}
],
"sparse_embedding": [
{
"embedding": {
"additionalProperty1": 42.0,
"additionalProperty2": 42.0
}
}
],
"completion": [
{
"result": "string"
}
],
"rerank": [
{
"index": 42.0,
"relevance_score": 42.0,
"text": "string"
}
]
}
Simulate a pipeline
Added in 5.0.0
Run an ingest pipeline against a set of provided documents. You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request.
Query parameters
-
verbose
boolean If
true
, the response includes output data for each processor in the executed pipeline.
curl \
--request POST 'http://api.example.com/_ingest/pipeline/_simulate' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '"{\n \"pipeline\" :\n {\n \"description\": \"_description\",\n \"processors\": [\n {\n \"set\" : {\n \"field\" : \"field2\",\n \"value\" : \"_value\"\n }\n }\n ]\n },\n \"docs\": [\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n}"'
{
"pipeline" :
{
"description": "_description",
"processors": [
{
"set" : {
"field" : "field2",
"value" : "_value"
}
}
]
},
"docs": [
{
"_index": "index",
"_id": "id",
"_source": {
"foo": "bar"
}
},
{
"_index": "index",
"_id": "id",
"_source": {
"foo": "rab"
}
}
]
}
{
"docs": [
{
"doc": {
"_id": "id",
"_index": "index",
"_version": "-3",
"_source": {
"field2": "_value",
"foo": "bar"
},
"_ingest": {
"timestamp": "2017-05-04T22:30:03.187Z"
}
}
},
{
"doc": {
"_id": "id",
"_index": "index",
"_version": "-3",
"_source": {
"field2": "_value",
"foo": "rab"
},
"_ingest": {
"timestamp": "2017-05-04T22:30:03.188Z"
}
}
}
]
}
Licensing
Licensing APIs enable you to manage your licenses.
Get license information
Get information about your Elastic license including its type, its status, when it was issued, and when it expires.
If the master node is generating a new cluster state, the get license API may return a 404 Not Found
response.
If you receive an unexpected 404 response after cluster startup, wait a short period and retry the request.
Query parameters
-
accept_enterprise
boolean Deprecated If
true
, this parameter returns enterprise for Enterprise license types. Iffalse
, this parameter returns platinum for both platinum and enterprise license types. This behavior is maintained for backwards compatibility. This parameter is deprecated and will always be set to true in 8.x. -
local
boolean Specifies whether to retrieve local information. The default value is
false
, which means the information is retrieved from the master node.
curl \
--request GET 'http://api.example.com/_license' \
--header "Authorization: $API_KEY"
{
"license" : {
"status" : "active",
"uid" : "cbff45e7-c553-41f7-ae4f-9205eabd80xx",
"type" : "trial",
"issue_date" : "2018-10-20T22:05:12.332Z",
"issue_date_in_millis" : 1540073112332,
"expiry_date" : "2018-11-19T22:05:12.332Z",
"expiry_date_in_millis" : 1542665112332,
"max_nodes" : 1000,
"max_resource_units" : null,
"issued_to" : "test",
"issuer" : "elasticsearch",
"start_date_in_millis" : -1
}
}
Get the basic license status
Added in 6.3.0
curl \
--request GET 'http://api.example.com/_license/basic_status' \
--header "Authorization: $API_KEY"
{
"eligible_to_start_basic": true
}
Create a calendar
Added in 6.2.0
Path parameters
-
calendar_id
string Required A string that uniquely identifies a calendar.
Body
-
job_ids
array[string] An array of anomaly detection job identifiers.
-
description
string A description of the calendar.
curl \
--request PUT 'http://api.example.com/_ml/calendars/{calendar_id}' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '{"job_ids":["string"],"description":"string"}'
{
"job_ids": [
"string"
],
"description": "string"
}
{
"calendar_id": "string",
"description": "string",
"": "string"
}
Get anomaly detection jobs configuration info
Added in 5.5.0
You can get information for multiple anomaly detection jobs in a single API
request by using a group name, a comma-separated list of jobs, or a wildcard
expression. You can get information for all anomaly detection jobs by using
_all
, by specifying *
as the <job_id>
, or by omitting the <job_id>
.
Path parameters
-
job_id
string | array[string] Required Identifier for the anomaly detection job. It can be a job identifier, a group name, or a wildcard expression. If you do not specify one of these options, the API returns information for all anomaly detection jobs.
Query parameters
-
allow_no_match
boolean Specifies what to do when the request:
- Contains wildcard expressions and there are no jobs that match.
- Contains the _all string or no identifiers and there are no matches.
- Contains wildcard expressions and there are only partial matches.
The default value is
true
, which returns an emptyjobs
array when there are no matches and the subset of results when there are partial matches. If this parameter isfalse
, the request returns a404
status code when there are no matches or only partial matches. -
exclude_generated
boolean Indicates if certain fields should be removed from the configuration on retrieval. This allows the configuration to be in an acceptable format to be retrieved and then added to another cluster.
curl \
--request GET 'http://api.example.com/_ml/anomaly_detectors/{job_id}' \
--header "Authorization: $API_KEY"
{
"count": 42.0,
"jobs": [
{
"allow_lazy_open": true,
"analysis_config": {
"bucket_span": "string",
"": "string",
"categorization_field_name": "string",
"categorization_filters": [
"string"
],
"detectors": [
{
"by_field_name": "string",
"custom_rules": [
{}
],
"detector_description": "string",
"detector_index": 42.0,
"exclude_frequent": "all",
"field_name": "string",
"function": "string",
"over_field_name": "string",
"partition_field_name": "string",
"use_null": true
}
],
"influencers": [
"string"
],
"latency": "string",
"model_prune_window": "string",
"multivariate_by_fields": true,
"per_partition_categorization": {
"enabled": true,
"stop_on_warn": true
},
"summary_count_field_name": "string"
},
"analysis_limits": {
"categorization_examples_limit": 42.0,
"": 42.0
},
"background_persist_interval": "string",
"blocked": {
"reason": "delete",
"": "string"
},
"": "string",
"custom_settings": {},
"daily_model_snapshot_retention_after_days": 42.0,
"data_description": {
"format": "string",
"time_field": "string",
"time_format": "string",
"field_delimiter": "string"
},
"datafeed_config": {
"aggregations": {},
"authorization": {
"api_key": {
"id": "string",
"name": "string"
},
"roles": [
"string"
],
"service_account": "string"
},
"chunking_config": {
"mode": "auto",
"time_span": "string"
},
"datafeed_id": "string",
"frequency": "string",
"indices": [
"string"
],
"indexes": [
"string"
],
"job_id": "string",
"max_empty_searches": 42.0,
"query_delay": "string",
"script_fields": {
"additionalProperty1": {
"script": {},
"ignore_failure": true
},
"additionalProperty2": {
"script": {},
"ignore_failure": true
}
},
"scroll_size": 42.0,
"delayed_data_check_config": {
"check_window": "string",
"enabled": true
},
"runtime_mappings": {
"additionalProperty1": {
"fields": {},
"fetch_fields": [
{}
],
"format": "string",
"input_field": "string",
"target_field": "string",
"target_index": "string",
"script": {},
"type": "boolean"
},
"additionalProperty2": {
"fields": {},
"fetch_fields": [
{}
],
"format": "string",
"input_field": "string",
"target_field": "string",
"target_index": "string",
"script": {},
"type": "boolean"
}
},
"indices_options": {
"allow_no_indices": true,
"expand_wildcards": "string",
"ignore_unavailable": true,
"ignore_throttled": true
},
"query": {}
},
"deleting": true,
"description": "string",
"groups": [
"string"
],
"job_id": "string",
"job_type": "string",
"job_version": "string",
"model_plot_config": {
"annotations_enabled": true,
"enabled": true,
"terms": "string"
},
"model_snapshot_id": "string",
"model_snapshot_retention_days": 42.0,
"renormalization_window_days": 42.0,
"results_index_name": "string",
"results_retention_days": 42.0
}
]
}
Preview a datafeed
Added in 5.4.0
This API returns the first "page" of search results from a datafeed. You can preview an existing datafeed or provide configuration details for a datafeed and anomaly detection job in the API. The preview shows the structure of the data that will be passed to the anomaly detection engine. IMPORTANT: When Elasticsearch security features are enabled, the preview uses the credentials of the user that called the API. However, when the datafeed starts it uses the roles of the last user that created or updated the datafeed. To get a preview that accurately reflects the behavior of the datafeed, use the appropriate credentials. You can also use secondary authorization headers to supply the credentials.
Path parameters
-
datafeed_id
string Required A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters. NOTE: If you use this path parameter, you cannot provide datafeed or anomaly detection job configuration details in the request body.
Body
-
datafeed_config
object -
job_config
object
curl \
--request POST 'http://api.example.com/_ml/datafeeds/{datafeed_id}/_preview' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '{"datafeed_config":{"aggregations":{},"chunking_config":{"mode":"auto","time_span":"string"},"datafeed_id":"string","delayed_data_check_config":{"check_window":"string","enabled":true},"frequency":"string","indices":"string","indices_options":{"allow_no_indices":true,"expand_wildcards":"string","ignore_unavailable":true,"ignore_throttled":true},"job_id":"string","max_empty_searches":42.0,"query":{},"query_delay":"string","runtime_mappings":{"additionalProperty1":{"fields":{"additionalProperty1":{"type":"boolean"},"additionalProperty2":{"type":"boolean"}},"fetch_fields":[{"field":"string","format":"string"}],"format":"string","input_field":"string","target_field":"string","target_index":"string","script":{"":"painless","id":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"options":{"additionalProperty1":"string","additionalProperty2":"string"}},"type":"boolean"},"additionalProperty2":{"fields":{"additionalProperty1":{"type":"boolean"},"additionalProperty2":{"type":"boolean"}},"fetch_fields":[{"field":"string","format":"string"}],"format":"string","input_field":"string","target_field":"string","target_index":"string","script":{"":"painless","id":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"options":{"additionalProperty1":"string","additionalProperty2":"string"}},"type":"boolean"}},"script_fields":{"additionalProperty1":{"script":{"":"painless","id":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"options":{"additionalProperty1":"string","additionalProperty2":"string"}},"ignore_failure":true},"additionalProperty2":{"script":{"":"painless","id":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"options":{"additionalProperty1":"string","additionalProperty2":"string"}},"ignore_failure":true}},"scroll_size":42.0},"job_config":{"allow_lazy_open":true,"analysis_config":{"bucket_span":"string","":"string","categorization_field_name":"string","categorization_filters":["string"],"detectors":[{"by_field_name":"string","custom_rules":[{"actions":["skip_result"],"conditions":[{}],"scope":{}}],"detector_description":"string","detector_index":42.0,"exclude_frequent":"all","field_name":"string","function":"string","over_field_name":"string","partition_field_name":"string","use_null":true}],"influencers":["string"],"latency":"string","model_prune_window":"string","multivariate_by_fields":true,"per_partition_categorization":{"enabled":true,"stop_on_warn":true},"summary_count_field_name":"string"},"analysis_limits":{"categorization_examples_limit":42.0,"":42.0},"background_persist_interval":"string","custom_settings":{},"daily_model_snapshot_retention_after_days":42.0,"data_description":{"format":"string","time_field":"string","time_format":"string","field_delimiter":"string"},"datafeed_config":{"aggregations":{},"chunking_config":{"mode":"auto","time_span":"string"},"datafeed_id":"string","delayed_data_check_config":{"check_window":"string","enabled":true},"frequency":"string","indices":"string","indices_options":{"allow_no_indices":true,"expand_wildcards":"string","ignore_unavailable":true,"ignore_throttled":true},"job_id":"string","max_empty_searches":42.0,"query":{},"query_delay":"string","runtime_mappings":{"additionalProperty1":{"fields":{"additionalProperty1":{"type":"boolean"},"additionalProperty2":{"type":"boolean"}},"fetch_fields":[{"field":"string","format":"string"}],"format":"string","input_field":"string","target_field":"string","target_index":"string","script":{"":"painless","id":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"options":{"additionalProperty1":"string","additionalProperty2":"string"}},"type":"boolean"},"additionalProperty2":{"fields":{"additionalProperty1":{"type":"boolean"},"additionalProperty2":{"type":"boolean"}},"fetch_fields":[{"field":"string","format":"string"}],"format":"string","input_field":"string","target_field":"string","target_index":"string","script":{"":"painless","id":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"options":{"additionalProperty1":"string","additionalProperty2":"string"}},"type":"boolean"}},"script_fields":{"additionalProperty1":{"script":{"":"painless","id":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"options":{"additionalProperty1":"string","additionalProperty2":"string"}},"ignore_failure":true},"additionalProperty2":{"script":{"":"painless","id":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"options":{"additionalProperty1":"string","additionalProperty2":"string"}},"ignore_failure":true}},"scroll_size":42.0},"description":"string","groups":["string"],"job_id":"string","job_type":"string","model_plot_config":{"annotations_enabled":true,"enabled":true,"terms":"string"},"model_snapshot_retention_days":42.0,"renormalization_window_days":42.0,"results_index_name":"string","results_retention_days":42.0}}'
{
"datafeed_config": {
"aggregations": {},
"chunking_config": {
"mode": "auto",
"time_span": "string"
},
"datafeed_id": "string",
"delayed_data_check_config": {
"check_window": "string",
"enabled": true
},
"frequency": "string",
"indices": "string",
"indices_options": {
"allow_no_indices": true,
"expand_wildcards": "string",
"ignore_unavailable": true,
"ignore_throttled": true
},
"job_id": "string",
"max_empty_searches": 42.0,
"query": {},
"query_delay": "string",
"runtime_mappings": {
"additionalProperty1": {
"fields": {
"additionalProperty1": {
"type": "boolean"
},
"additionalProperty2": {
"type": "boolean"
}
},
"fetch_fields": [
{
"field": "string",
"format": "string"
}
],
"format": "string",
"input_field": "string",
"target_field": "string",
"target_index": "string",
"script": {
"": "painless",
"id": "string",
"params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"options": {
"additionalProperty1": "string",
"additionalProperty2": "string"
}
},
"type": "boolean"
},
"additionalProperty2": {
"fields": {
"additionalProperty1": {
"type": "boolean"
},
"additionalProperty2": {
"type": "boolean"
}
},
"fetch_fields": [
{
"field": "string",
"format": "string"
}
],
"format": "string",
"input_field": "string",
"target_field": "string",
"target_index": "string",
"script": {
"": "painless",
"id": "string",
"params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"options": {
"additionalProperty1": "string",
"additionalProperty2": "string"
}
},
"type": "boolean"
}
},
"script_fields": {
"additionalProperty1": {
"script": {
"": "painless",
"id": "string",
"params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"options": {
"additionalProperty1": "string",
"additionalProperty2": "string"
}
},
"ignore_failure": true
},
"additionalProperty2": {
"script": {
"": "painless",
"id": "string",
"params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"options": {
"additionalProperty1": "string",
"additionalProperty2": "string"
}
},
"ignore_failure": true
}
},
"scroll_size": 42.0
},
"job_config": {
"allow_lazy_open": true,
"analysis_config": {
"bucket_span": "string",
"": "string",
"categorization_field_name": "string",
"categorization_filters": [
"string"
],
"detectors": [
{
"by_field_name": "string",
"custom_rules": [
{
"actions": [
"skip_result"
],
"conditions": [
{}
],
"scope": {}
}
],
"detector_description": "string",
"detector_index": 42.0,
"exclude_frequent": "all",
"field_name": "string",
"function": "string",
"over_field_name": "string",
"partition_field_name": "string",
"use_null": true
}
],
"influencers": [
"string"
],
"latency": "string",
"model_prune_window": "string",
"multivariate_by_fields": true,
"per_partition_categorization": {
"enabled": true,
"stop_on_warn": true
},
"summary_count_field_name": "string"
},
"analysis_limits": {
"categorization_examples_limit": 42.0,
"": 42.0
},
"background_persist_interval": "string",
"custom_settings": {},
"daily_model_snapshot_retention_after_days": 42.0,
"data_description": {
"format": "string",
"time_field": "string",
"time_format": "string",
"field_delimiter": "string"
},
"datafeed_config": {
"aggregations": {},
"chunking_config": {
"mode": "auto",
"time_span": "string"
},
"datafeed_id": "string",
"delayed_data_check_config": {
"check_window": "string",
"enabled": true
},
"frequency": "string",
"indices": "string",
"indices_options": {
"allow_no_indices": true,
"expand_wildcards": "string",
"ignore_unavailable": true,
"ignore_throttled": true
},
"job_id": "string",
"max_empty_searches": 42.0,
"query": {},
"query_delay": "string",
"runtime_mappings": {
"additionalProperty1": {
"fields": {
"additionalProperty1": {
"type": "boolean"
},
"additionalProperty2": {
"type": "boolean"
}
},
"fetch_fields": [
{
"field": "string",
"format": "string"
}
],
"format": "string",
"input_field": "string",
"target_field": "string",
"target_index": "string",
"script": {
"": "painless",
"id": "string",
"params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"options": {
"additionalProperty1": "string",
"additionalProperty2": "string"
}
},
"type": "boolean"
},
"additionalProperty2": {
"fields": {
"additionalProperty1": {
"type": "boolean"
},
"additionalProperty2": {
"type": "boolean"
}
},
"fetch_fields": [
{
"field": "string",
"format": "string"
}
],
"format": "string",
"input_field": "string",
"target_field": "string",
"target_index": "string",
"script": {
"": "painless",
"id": "string",
"params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"options": {
"additionalProperty1": "string",
"additionalProperty2": "string"
}
},
"type": "boolean"
}
},
"script_fields": {
"additionalProperty1": {
"script": {
"": "painless",
"id": "string",
"params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"options": {
"additionalProperty1": "string",
"additionalProperty2": "string"
}
},
"ignore_failure": true
},
"additionalProperty2": {
"script": {
"": "painless",
"id": "string",
"params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"options": {
"additionalProperty1": "string",
"additionalProperty2": "string"
}
},
"ignore_failure": true
}
},
"scroll_size": 42.0
},
"description": "string",
"groups": [
"string"
],
"job_id": "string",
"job_type": "string",
"model_plot_config": {
"annotations_enabled": true,
"enabled": true,
"terms": "string"
},
"model_snapshot_retention_days": 42.0,
"renormalization_window_days": 42.0,
"results_index_name": "string",
"results_retention_days": 42.0
}
}
[
{}
]
Update a snapshot
Added in 5.4.0
Updates certain properties of a snapshot.
Path parameters
-
job_id
string Required Identifier for the anomaly detection job.
-
snapshot_id
string Required Identifier for the model snapshot.
Body
Required
-
description
string A description of the model snapshot.
-
retain
boolean If
true
, this snapshot will not be deleted during automatic cleanup of snapshots older thanmodel_snapshot_retention_days
. However, this snapshot will be deleted when the job is deleted.
curl \
--request POST 'http://api.example.com/_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_update' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '{"description":"string","retain":true}'
{
"description": "string",
"retain": true
}
{
"acknowledged": true,
"model": {
"description": "string",
"job_id": "string",
"latest_record_time_stamp": 42.0,
"latest_result_time_stamp": 42.0,
"min_version": "string",
"model_size_stats": {
"bucket_allocation_failures_count": 42.0,
"job_id": "string",
"": 42.0,
"memory_status": "ok",
"assignment_memory_basis": "string",
"result_type": "string",
"total_by_field_count": 42.0,
"total_over_field_count": 42.0,
"total_partition_field_count": 42.0,
"categorization_status": "ok",
"categorized_doc_count": 42.0,
"dead_category_count": 42.0,
"failed_category_count": 42.0,
"frequent_category_count": 42.0,
"rare_category_count": 42.0,
"total_category_count": 42.0,
"timestamp": 42.0
},
"retain": true,
"snapshot_doc_count": 42.0,
"snapshot_id": "string",
"timestamp": 42.0
}
}
Upgrade a snapshot
Added in 5.4.0
Upgrade an anomaly detection model snapshot to the latest major version. Over time, older snapshot formats are deprecated and removed. Anomaly detection jobs support only snapshots that are from the current or previous major version. This API provides a means to upgrade a snapshot to the current major version. This aids in preparing the cluster for an upgrade to the next major version. Only one snapshot per anomaly detection job can be upgraded at a time and the upgraded snapshot cannot be the current snapshot of the anomaly detection job.
Path parameters
-
job_id
string Required Identifier for the anomaly detection job.
-
snapshot_id
string Required A numerical character string that uniquely identifies the model snapshot.
Query parameters
-
wait_for_completion
boolean When true, the API won’t respond until the upgrade is complete. Otherwise, it responds as soon as the upgrade task is assigned to a node.
-
timeout
string Controls the time to wait for the request to complete.
curl \
--request POST 'http://api.example.com/_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_upgrade' \
--header "Authorization: $API_KEY"
{
"node": "string",
"completed": true
}
Preview features used by data frame analytics
Added in 7.13.0
Preview the extracted features used by a data frame analytics config.
curl \
--request POST 'http://api.example.com/_ml/data_frame/analytics/_preview' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '{"config":{"source":{"index":"string","runtime_mappings":{"additionalProperty1":{"fields":{"additionalProperty1":{"type":"boolean"},"additionalProperty2":{"type":"boolean"}},"fetch_fields":[{"field":"string","format":"string"}],"format":"string","input_field":"string","target_field":"string","target_index":"string","script":{"":"painless","id":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"options":{"additionalProperty1":"string","additionalProperty2":"string"}},"type":"boolean"},"additionalProperty2":{"fields":{"additionalProperty1":{"type":"boolean"},"additionalProperty2":{"type":"boolean"}},"fetch_fields":[{"field":"string","format":"string"}],"format":"string","input_field":"string","target_field":"string","target_index":"string","script":{"":"painless","id":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"options":{"additionalProperty1":"string","additionalProperty2":"string"}},"type":"boolean"}},"_source":{"includes":["string"],"excludes":["string"]},"query":{}},"analysis":{"classification":{"alpha":42.0,"dependent_variable":"string","downsample_factor":42.0,"early_stopping_enabled":true,"eta":42.0,"eta_growth_rate_per_tree":42.0,"feature_bag_fraction":42.0,"feature_processors":[{"frequency_encoding":{},"multi_encoding":{},"n_gram_encoding":{},"one_hot_encoding":{},"target_mean_encoding":{}}],"gamma":42.0,"lambda":42.0,"max_optimization_rounds_per_hyperparameter":42.0,"max_trees":42.0,"num_top_feature_importance_values":42.0,"prediction_field_name":"string","randomize_seed":42.0,"soft_tree_depth_limit":42.0,"soft_tree_depth_tolerance":42.0,"":"string","class_assignment_objective":"string","num_top_classes":42.0},"outlier_detection":{"compute_feature_influence":true,"feature_influence_threshold":42.0,"method":"string","n_neighbors":42.0,"outlier_fraction":42.0,"standardization_enabled":true},"regression":{"alpha":42.0,"dependent_variable":"string","downsample_factor":42.0,"early_stopping_enabled":true,"eta":42.0,"eta_growth_rate_per_tree":42.0,"feature_bag_fraction":42.0,"feature_processors":[{"frequency_encoding":{},"multi_encoding":{},"n_gram_encoding":{},"one_hot_encoding":{},"target_mean_encoding":{}}],"gamma":42.0,"lambda":42.0,"max_optimization_rounds_per_hyperparameter":42.0,"max_trees":42.0,"num_top_feature_importance_values":42.0,"prediction_field_name":"string","randomize_seed":42.0,"soft_tree_depth_limit":42.0,"soft_tree_depth_tolerance":42.0,"":"string","loss_function":"string","loss_function_parameter":42.0}},"model_memory_limit":"string","max_num_threads":42.0,"analyzed_fields":{"includes":["string"],"excludes":["string"]}}}'
{
"config": {
"source": {
"index": "string",
"runtime_mappings": {
"additionalProperty1": {
"fields": {
"additionalProperty1": {
"type": "boolean"
},
"additionalProperty2": {
"type": "boolean"
}
},
"fetch_fields": [
{
"field": "string",
"format": "string"
}
],
"format": "string",
"input_field": "string",
"target_field": "string",
"target_index": "string",
"script": {
"": "painless",
"id": "string",
"params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"options": {
"additionalProperty1": "string",
"additionalProperty2": "string"
}
},
"type": "boolean"
},
"additionalProperty2": {
"fields": {
"additionalProperty1": {
"type": "boolean"
},
"additionalProperty2": {
"type": "boolean"
}
},
"fetch_fields": [
{
"field": "string",
"format": "string"
}
],
"format": "string",
"input_field": "string",
"target_field": "string",
"target_index": "string",
"script": {
"": "painless",
"id": "string",
"params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"options": {
"additionalProperty1": "string",
"additionalProperty2": "string"
}
},
"type": "boolean"
}
},
"_source": {
"includes": [
"string"
],
"excludes": [
"string"
]
},
"query": {}
},
"analysis": {
"classification": {
"alpha": 42.0,
"dependent_variable": "string",
"downsample_factor": 42.0,
"early_stopping_enabled": true,
"eta": 42.0,
"eta_growth_rate_per_tree": 42.0,
"feature_bag_fraction": 42.0,
"feature_processors": [
{
"frequency_encoding": {},
"multi_encoding": {},
"n_gram_encoding": {},
"one_hot_encoding": {},
"target_mean_encoding": {}
}
],
"gamma": 42.0,
"lambda": 42.0,
"max_optimization_rounds_per_hyperparameter": 42.0,
"max_trees": 42.0,
"num_top_feature_importance_values": 42.0,
"prediction_field_name": "string",
"randomize_seed": 42.0,
"soft_tree_depth_limit": 42.0,
"soft_tree_depth_tolerance": 42.0,
"": "string",
"class_assignment_objective": "string",
"num_top_classes": 42.0
},
"outlier_detection": {
"compute_feature_influence": true,
"feature_influence_threshold": 42.0,
"method": "string",
"n_neighbors": 42.0,
"outlier_fraction": 42.0,
"standardization_enabled": true
},
"regression": {
"alpha": 42.0,
"dependent_variable": "string",
"downsample_factor": 42.0,
"early_stopping_enabled": true,
"eta": 42.0,
"eta_growth_rate_per_tree": 42.0,
"feature_bag_fraction": 42.0,
"feature_processors": [
{
"frequency_encoding": {},
"multi_encoding": {},
"n_gram_encoding": {},
"one_hot_encoding": {},
"target_mean_encoding": {}
}
],
"gamma": 42.0,
"lambda": 42.0,
"max_optimization_rounds_per_hyperparameter": 42.0,
"max_trees": 42.0,
"num_top_feature_importance_values": 42.0,
"prediction_field_name": "string",
"randomize_seed": 42.0,
"soft_tree_depth_limit": 42.0,
"soft_tree_depth_tolerance": 42.0,
"": "string",
"loss_function": "string",
"loss_function_parameter": 42.0
}
},
"model_memory_limit": "string",
"max_num_threads": 42.0,
"analyzed_fields": {
"includes": [
"string"
],
"excludes": [
"string"
]
}
}
}
{
"feature_values": [
{
"additionalProperty1": "string",
"additionalProperty2": "string"
}
]
}
Get trained model configuration info
Added in 7.10.0
Query parameters
-
allow_no_match
boolean Specifies what to do when the request:
- Contains wildcard expressions and there are no models that match.
- Contains the _all string or no identifiers and there are no matches.
- Contains wildcard expressions and there are only partial matches.
If true, it returns an empty array when there are no matches and the subset of results when there are partial matches.
-
decompress_definition
boolean Specifies whether the included model definition should be returned as a JSON map (true) or in a custom compressed format (false).
-
exclude_generated
boolean Indicates if certain fields should be removed from the configuration on retrieval. This allows the configuration to be in an acceptable format to be retrieved and then added to another cluster.
-
from
number Skips the specified number of models.
-
include
string A comma delimited string of optional fields to include in the response body.
Values are
definition
,feature_importance_baseline
,hyperparameters
,total_feature_importance
, ordefinition_status
. -
size
number Specifies the maximum number of models to obtain.
curl \
--request GET 'http://api.example.com/_ml/trained_models' \
--header "Authorization: $API_KEY"
{
"count": 42.0,
"trained_model_configs": [
{
"model_id": "string",
"model_type": "tree_ensemble",
"tags": [
"string"
],
"version": "string",
"compressed_definition": "string",
"created_by": "string",
"": 42.0,
"default_field_map": {
"additionalProperty1": "string",
"additionalProperty2": "string"
},
"description": "string",
"estimated_heap_memory_usage_bytes": 42.0,
"estimated_operations": 42.0,
"fully_defined": true,
"inference_config": {
"regression": {
"results_field": "string",
"num_top_feature_importance_values": 42.0
},
"classification": {
"num_top_classes": 42.0,
"num_top_feature_importance_values": 42.0,
"prediction_field_type": "string",
"results_field": "string",
"top_classes_results_field": "string"
},
"text_classification": {
"num_top_classes": 42.0,
"tokenization": {},
"results_field": "string",
"classification_labels": [
"string"
],
"vocabulary": {
"index": "string"
}
},
"zero_shot_classification": {
"tokenization": {},
"hypothesis_template": "string",
"classification_labels": [
"string"
],
"results_field": "string",
"multi_label": true,
"labels": [
"string"
]
},
"fill_mask": {
"mask_token": "string",
"num_top_classes": 42.0,
"tokenization": {},
"results_field": "string",
"vocabulary": {
"index": "string"
}
},
"learning_to_rank": {
"default_params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"feature_extractors": [
{}
],
"num_top_feature_importance_values": 42.0
},
"ner": {
"tokenization": {},
"results_field": "string",
"classification_labels": [
"string"
],
"vocabulary": {
"index": "string"
}
},
"pass_through": {
"tokenization": {},
"results_field": "string",
"vocabulary": {
"index": "string"
}
},
"text_embedding": {
"embedding_size": 42.0,
"tokenization": {},
"results_field": "string",
"vocabulary": {
"index": "string"
}
},
"text_expansion": {
"tokenization": {},
"results_field": "string",
"vocabulary": {
"index": "string"
}
},
"question_answering": {
"num_top_classes": 42.0,
"tokenization": {},
"results_field": "string",
"max_answer_length": 42.0
}
},
"input": {
"field_names": [
"string"
]
},
"license_level": "string",
"metadata": {
"model_aliases": [
"string"
],
"feature_importance_baseline": {
"additionalProperty1": "string",
"additionalProperty2": "string"
},
"hyperparameters": [
{
"absolute_importance": 42.0,
"name": "string",
"relative_importance": 42.0,
"supplied": true,
"value": 42.0
}
],
"total_feature_importance": [
{
"feature_name": "string",
"importance": [
{}
],
"classes": [
{}
]
}
]
},
"model_package": {
"": 42.0,
"description": "string",
"inference_config": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"metadata": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"minimum_version": "string",
"model_repository": "string",
"model_type": "string",
"packaged_model_id": "string",
"platform_architecture": "string",
"prefix_strings": {
"ingest": "string",
"search": "string"
},
"sha256": "string",
"tags": [
"string"
],
"vocabulary_file": "string"
},
"location": {
"index": {
"name": "string"
}
},
"platform_architecture": "string",
"prefix_strings": {
"ingest": "string",
"search": "string"
}
}
]
}