Skip to content

Commit 04d2ae5

Browse files
committed
Applies suggestions from code review
1 parent 496ec0f commit 04d2ae5

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

explore-analyze/elastic-inference/inference-api.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,14 @@ PUT _inference/sparse_embedding/word_chunks
157157

158158
#### `recursive`
159159

160-
{applies_to}`stack: ga 9.1`
160+
```{applies_to}
161+
stack: ga 9.1`
162+
```
161163

162164
The `recursive` strategy splits the input text based on a configurable list of separator patterns (for example, newlines or Markdown headers). The chunker applies these separators in order, recursively splitting any chunk that exceeds the `max_chunk_size` word limit. If no separator produces a small enough chunk, the strategy falls back to sentence-level splitting.
163165

166+
##### Markdown separator group
167+
164168
The following example creates an {{infer}} endpoint with the `elasticsearch` service that deploys the ELSER model and configures chunking with the `recursive` strategy using the markdown separator group and a maximum of 200 words per chunk.
165169

166170
```console
@@ -180,9 +184,39 @@ PUT _inference/sparse_embedding/recursive_markdown_chunks
180184
}
181185
```
182186

187+
##### Custom separator group
188+
189+
The following example creates an {{infer}} endpoint with the `elasticsearch` service that deploys the ELSER model and configures chunking with the `recursive` strategy. It uses a custom list of separators to split plaintext into chunks of up to 180 words.
190+
191+
192+
```console
193+
PUT _inference/sparse_embedding/recursive_custom_chunks
194+
{
195+
"service": "elasticsearch",
196+
"service_settings": {
197+
"model_id": ".elser_model_2",
198+
"num_allocations": 1,
199+
"num_threads": 1
200+
},
201+
"chunking_settings": {
202+
"strategy": "recursive",
203+
"max_chunk_size": 180,
204+
"separators": [
205+
"^(#{1,6})\\s",
206+
"\\n\\n",
207+
"\\n[-*]\\s",
208+
"\\n\\d+\\.\\s",
209+
"\\n"
210+
]
211+
}
212+
}
213+
```
214+
183215
#### `none`
184216

185-
{applies_to}`stack: ga 9.1`
217+
```{applies_to}
218+
stack: ga 9.1`
219+
```
186220

187221
The `none` strategy disables chunking and processes the entire input text as a single block, without any splitting or overlap. When using this strategy, you can instead [pre-chunk](https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/semantic-text#auto-text-chunking) the input by providing an array of strings, where each element acts as a separate chunk to be sent directly to the inference service without further chunking.
188222

0 commit comments

Comments
 (0)