AuthThe Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats.AvailabilityGenerally available since 8.13This functionality is generally available and ready for production usage.Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments.This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.
Create an inference endpoint to perform an inference task with the elasticsearch service.
Note
Your Elasticsearch deployment contains preconfigured ELSER and E5 inference endpoints, you only need to create the enpoints using the API if you want to customize the settings.
If you use the ELSER or the E5 model through the elasticsearch service, the API request will automatically download and deploy the model if it isn't downloaded yet.
Note
You might see a 502 bad gateway error in the response when using the Kibana Console. This error usually just reflects a timeout, while the model downloads in the background. You can check the download progress in the Machine Learning UI. If using the Python client, you can set the timeout parameter to a higher value.
After creating the endpoint, wait for the model deployment to complete before using it.
To verify the deployment status, use the get trained model statistics API.
Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count".
Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources.
The maximum size of a chunk in words.
This value cannot be higher than 300 or lower than 20 (for sentence strategy) or 10 (for word strategy).
overlapnumber · default: 100
The number of overlapping words for chunks.
It is applicable only to a word chunking strategy.
This value cannot be higher than half the max_chunk_size value.
sentence_overlapnumber · default: 1
The number of overlapping sentences for chunks.
It is applicable only for a sentence chunking strategy.
It can be either 1 or 0.
strategystring · default: sentence
The chunking strategy: sentence or word.
serviceenumrequired
The type of service supported for the specified task type. In this case, elasticsearch.
Values:elasticsearch
service_settingsobjectrequired
Settings used to install the inference model. These settings are specific to the elasticsearch service.
adaptive_allocationsobject
Adaptive allocations configuration details.
If enabled is true, the number of allocations of the model is set based on the current load the process gets.
When the load is high, a new model allocation is automatically created, respecting the value of max_number_of_allocations if it's set.
When the load is low, a model allocation is automatically removed, respecting the value of min_number_of_allocations if it's set.
If enabled is true, do not set the number of allocations manually.
enabledboolean · default: false
Turn on adaptive_allocations.
max_number_of_allocationsnumber
The maximum number of allocations to scale to.
If set, it must be greater than or equal to min_number_of_allocations.
min_number_of_allocationsnumber
The minimum number of allocations to scale to.
If set, it must be greater than or equal to 0.
If not defined, the deployment scales to 0.
deployment_idstring
The deployment identifier for a trained model deployment.
When deployment_id is used the model_id is optional.
model_idstringrequired
The name of the model to use for the inference task.
It can be the ID of a built-in model (for example, .multilingual-e5-small for E5) or a text embedding model that was uploaded by using the Eland client.
The total number of allocations that are assigned to the model across machine learning nodes.
Increasing this value generally increases the throughput.
If adaptive allocations are enabled, do not set this value because it's automatically set.
num_threadsnumberrequired
The number of threads used by each model allocation during inference.
This setting generally increases the speed per inference request.
The inference process is a compute-bound process; threads_per_allocations must not exceed the number of available allocated processors per node.
The value must be a power of 2.
The maximum value is 32.
task_settingsobject
Settings to configure the inference task.
These settings are specific to the task type you specified.
return_documentsboolean · default: true
For a rerank task, return the document instead of only the index.
The maximum size of a chunk in words.
This value cannot be higher than 300 or lower than 20 (for sentence strategy) or 10 (for word strategy).
overlapnumber · default: 100
The number of overlapping words for chunks.
It is applicable only to a word chunking strategy.
This value cannot be higher than half the max_chunk_size value.
sentence_overlapnumber · default: 1
The number of overlapping sentences for chunks.
It is applicable only for a sentence chunking strategy.
It can be either 1 or 0.
strategystring · default: sentence
The chunking strategy: sentence or word.
servicestringrequired
The service type
service_settingsobjectrequired
Settings specific to the service
task_settingsobject
Task settings specific to the service and task type