Min_number_of_allocations for .elser-2-elasticsearch reverted to 0 and inference failures during bulk indexing

We are using the preconfigured ELSER inference endpoint .elser-2-elasticsearch with a semantic_text field.

During a full bulk indexing operation, some documents fail with:

inference_exception: Exception when running inference id
[.elser-2-elasticsearch] on field [prism_semantic]

The entire document fails to index when this occurs.

We previously configured the ELSER deployment with:

"adaptive_allocations": {
  "enabled": true,
  "min_number_of_allocations": 1
}

However we later found that the deployment is back to:

"adaptive_allocations": {
  "enabled": true,
  "min_number_of_allocations": 0,
  "max_number_of_allocations": 32
}

Both GET _inference/.elser-2-elasticsearch and GET _ml/trained_models/.elser-2-elasticsearch/_stats now show:

"adaptive_allocations": {
  "enabled": true,
  "min_number_of_allocations": 0,
  "max_number_of_allocations": 32
}

Is it expected for the preconfigured .elser-2-elasticsearch endpoint to reset/recreate its deployment with min_number_of_allocations: 0?

If we need ELSER to remain available during large bulk indexing operations, what is the recommended way to persist min_number_of_allocations: 1?

We are using ECH 8.19.12

As far as I understand it, the .-prefixed preconfigured endpoints are managed by the platform. Their deployment settings can be put back to the defaults when the managed deployment is recreated, so a manual change to min_number_of_allocations there isn't something you can rely on to stick.

The usual way around this is to create your own inference endpoint for ELSER (for example PUT _inference/sparse_embedding/my-elser with the elasticsearch service, the ELSER v2 model id, and adaptive_allocations set to enabled: true, min_number_of_allocations: 1), then point the semantic_text field's inference_id at it. Because you own that endpoint, its settings are not reset with the managed one. Check whether your version lets you change inference_id on an existing semantic_text field; if not, you need a new field or index and a reindex.

Even with a minimum of 1, a large bulk job can outrun scale-up. Two things help: send bulk requests in smaller batches with retry and backoff on the inference failures (they are often temporary while allocations scale), and look at the _bulk response per item, so that only the failed documents are re-sent instead of the whole batch. Watching GET _ml/trained_models/<id>/_stats during the run shows whether allocations actually scale before the errors start.

I’d probably go with a custom inference endpoint if you need min_number_of_allocations to stay at 1. The preconfigured endpoint is managed by Elasticsearch, so manually changing its settings may not survive a deployment recreation.

That said, keeping one allocation running might not be enough if the bulk indexing workload is overwhelming the deployment. I’d try smaller bulk batches with retries and backoff for failed documents, and keep an eye on the allocation count during indexing.

It would also be worth checking whether the failures happen mainly when the deployment scales up from zero or continue even when an allocation is already running. That might help narrow down whether this is a scaling issue or a capacity problem.