---
type: api
title: Get an inference endpoint
description: **All methods and paths for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4641/api/doc/elasticsearch/v8/operation/operation-inference-get
resource: https://www.elastic.co/elastic/docs-builder/docs/4641/api/doc/elasticsearch/v8/operation/operation-inference-get
products:
  - Elasticsearch
---

# Get an inference endpoint

Authentication: required

Availability: Generally available since 8.11

## Paths

- `GET` `/_inference/{task_type}/{inference_id}`
- `GET` `/_inference/{task_type}/_all`
- `GET` `/_inference/{inference_id}`
- `GET` `/_inference`

#### Path parameters

- `task_type` (enum) — optional, leave it out to use `/_inference`
  The task type of the endpoint to return
  Values: `sparse_embedding`, `text_embedding`, `rerank`, `completion`, `chat_completion`
- `inference_id` (string) — optional, leave it out to use `/_inference`
  The inference Id of the endpoint to return. Using `_all` or `*` will return all endpoints with the specified
`task_type` if one is specified, or all endpoints for all task types if no `task_type` is specified

## Response

`application/json`

- `endpoints` (object[])
  - `chunking_settings` (object)
    Chunking configuration object
    - `max_chunk_size` (number · default: 250)
      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).
    - `overlap` (number · 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_overlap` (number · 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`.
    - `strategy` (string · default: sentence)
      The chunking strategy: `sentence` or `word`.
  - `service` (string)
    The service type
  - `service_settings` (object)
    Settings specific to the service
  - `task_settings` (object)
    Task settings specific to the service and task type
  - `inference_id` (string)
    The inference Id
  - `task_type` (enum)
    The task type
    Values: `sparse_embedding`, `text_embedding`, `rerank`, `completion`, `chat_completion`
## Code examples

#### Console

```console
GET _inference/sparse_embedding/my-elser-model
```

#### JavaScript

```javascript
const response = await client.inference.get({
  task_type: "sparse_embedding",
  inference_id: "my-elser-model",
});
```

#### Python

```python
resp = client.inference.get(
    task_type="sparse_embedding",
    inference_id="my-elser-model",
)
```

#### curl

```curl
curl -X GET "$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.inference().get(g -> g
    .inferenceId("my-elser-model")
    .taskType(TaskType.SparseEmbedding)
);
```

#### C#

```c#
var response = await client.Inference
    .GetAsync(d1 => d1
        .InferenceId("my-elser-model")
        .TaskType(TaskType.SparseEmbedding)
    );
```

#### PHP

```php
$resp = $client->inference()->get([
    "task_type" => "sparse_embedding",
    "inference_id" => "my-elser-model",
]);
```

#### Ruby

```ruby
response = client.inference.get(
  task_type: "sparse_embedding",
  inference_id: "my-elser-model"
)
```

## Response examples

#### 200

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "endpoints": [
    {
      "chunking_settings": {
        "max_chunk_size": 250,
        "overlap": 100,
        "sentence_overlap": 1,
        "strategy": "sentence"
      },
      "service": "string",
      "service_settings": {},
      "task_settings": {},
      "inference_id": "string",
      "task_type": "sparse_embedding"
    }
  ]
}
```

