Skip to content

Commit b3e4d76

Browse files
Merge branch '8.x' into backport/8.x/pr-115517
2 parents dfce4ea + b151c14 commit b3e4d76

File tree

41 files changed

+1162
-687
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1162
-687
lines changed

docs/changelog/115594.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 115594
2+
summary: Update `BlobCacheBufferedIndexInput::readVLong` to correctly handle negative
3+
long values
4+
area: Search
5+
type: bug
6+
issues: []

docs/reference/inference/inference-apis.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ the following APIs to manage {infer} models and perform {infer}:
1919
* <<get-inference-api>>
2020
* <<post-inference-api>>
2121
* <<put-inference-api>>
22+
* <<stream-inference-api>>
2223
* <<update-inference-api>>
2324

2425
[[inference-landscape]]
@@ -56,6 +57,7 @@ include::delete-inference.asciidoc[]
5657
include::get-inference.asciidoc[]
5758
include::post-inference.asciidoc[]
5859
include::put-inference.asciidoc[]
60+
include::stream-inference.asciidoc[]
5961
include::update-inference.asciidoc[]
6062
include::service-alibabacloud-ai-search.asciidoc[]
6163
include::service-amazon-bedrock.asciidoc[]
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
[role="xpack"]
2+
[[stream-inference-api]]
3+
=== Stream inference API
4+
5+
Streams a chat completion response.
6+
7+
IMPORTANT: The {infer} APIs enable you to use certain services, such as built-in {ml} models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face.
8+
For built-in models and models uploaded through Eland, the {infer} APIs offer an alternative way to use and manage trained models.
9+
However, if you do not plan to use the {infer} APIs to use these models or if you want to use non-NLP models, use the <<ml-df-trained-models-apis>>.
10+
11+
12+
[discrete]
13+
[[stream-inference-api-request]]
14+
==== {api-request-title}
15+
16+
`POST /_inference/<inference_id>/_stream`
17+
18+
`POST /_inference/<task_type>/<inference_id>/_stream`
19+
20+
21+
[discrete]
22+
[[stream-inference-api-prereqs]]
23+
==== {api-prereq-title}
24+
25+
* Requires the `monitor_inference` <<privileges-list-cluster,cluster privilege>>
26+
(the built-in `inference_admin` and `inference_user` roles grant this privilege)
27+
* You must use a client that supports streaming.
28+
29+
30+
[discrete]
31+
[[stream-inference-api-desc]]
32+
==== {api-description-title}
33+
34+
The stream {infer} API enables real-time responses for completion tasks by delivering answers incrementally, reducing response times during computation.
35+
It only works with the `completion` task type.
36+
37+
38+
[discrete]
39+
[[stream-inference-api-path-params]]
40+
==== {api-path-parms-title}
41+
42+
`<inference_id>`::
43+
(Required, string)
44+
The unique identifier of the {infer} endpoint.
45+
46+
47+
`<task_type>`::
48+
(Optional, string)
49+
The type of {infer} task that the model performs.
50+
51+
52+
[discrete]
53+
[[stream-inference-api-request-body]]
54+
==== {api-request-body-title}
55+
56+
`input`::
57+
(Required, string or array of strings)
58+
The text on which you want to perform the {infer} task.
59+
`input` can be a single string or an array.
60+
+
61+
--
62+
[NOTE]
63+
====
64+
Inference endpoints for the `completion` task type currently only support a
65+
single string as input.
66+
====
67+
--
68+
69+
70+
[discrete]
71+
[[stream-inference-api-example]]
72+
==== {api-examples-title}
73+
74+
The following example performs a completion on the example question with streaming.
75+
76+
77+
[source,console]
78+
------------------------------------------------------------
79+
POST _inference/completion/openai-completion/_stream
80+
{
81+
"input": "What is Elastic?"
82+
}
83+
------------------------------------------------------------
84+
// TEST[skip:TBD]
85+
86+
87+
The API returns the following response:
88+
89+
90+
[source,txt]
91+
------------------------------------------------------------
92+
event: message
93+
data: {
94+
"completion":[{
95+
"delta":"Elastic"
96+
}]
97+
}
98+
99+
event: message
100+
data: {
101+
"completion":[{
102+
"delta":" is"
103+
},
104+
{
105+
"delta":" a"
106+
}
107+
]
108+
}
109+
110+
event: message
111+
data: {
112+
"completion":[{
113+
"delta":" software"
114+
},
115+
{
116+
"delta":" company"
117+
}]
118+
}
119+
120+
(...)
121+
------------------------------------------------------------
122+
// NOTCONSOLE

muted-tests.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,6 @@ tests:
349349
- class: org.elasticsearch.xpack.security.operator.OperatorPrivilegesIT
350350
method: testEveryActionIsEitherOperatorOnlyOrNonOperator
351351
issue: https://github.com/elastic/elasticsearch/issues/102992
352-
- class: org.elasticsearch.bootstrap.SpawnerNoBootstrapTests
353-
issue: https://github.com/elastic/elasticsearch/issues/114555
354352
- class: org.elasticsearch.test.rest.yaml.RcsCcsCommonYamlTestSuiteIT
355353
method: test {p0=search.vectors/42_knn_search_int4_flat/Vector similarity with filter only}
356354
issue: https://github.com/elastic/elasticsearch/issues/115475

qa/no-bootstrap-tests/src/test/java/org/elasticsearch/bootstrap/SpawnerNoBootstrapTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.elasticsearch.plugins.Platforms;
2525
import org.elasticsearch.plugins.PluginTestUtil;
2626
import org.elasticsearch.test.GraalVMThreadsFilter;
27+
import org.elasticsearch.test.JnaCleanerThreadsFilter;
2728
import org.elasticsearch.test.MockLog;
2829

2930
import java.io.IOException;
@@ -50,7 +51,7 @@
5051
* that prevents the Spawner class from doing its job. Also needs to run in a separate JVM to other
5152
* tests that extend ESTestCase for the same reason.
5253
*/
53-
@ThreadLeakFilters(filters = { GraalVMThreadsFilter.class })
54+
@ThreadLeakFilters(filters = { GraalVMThreadsFilter.class, JnaCleanerThreadsFilter.class })
5455
public class SpawnerNoBootstrapTests extends LuceneTestCase {
5556

5657
private static final String CONTROLLER_SOURCE = """

qa/smoke-test-ingest-with-all-dependencies/src/yamlRestTest/resources/rest-api-spec/test/ingest/80_ingest_simulate.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,6 +1588,13 @@ setup:
15881588
cluster_features: ["simulate.support.non.template.mapping"]
15891589
reason: "ingest simulate support for indices with mappings that didn't come from templates added in 8.17"
15901590

1591+
# A global match-everything legacy template is added to the cluster sometimes (rarely). We have to get rid of this template if it exists
1592+
# because this test is making sure we get correct behavior when an index matches *no* template:
1593+
- do:
1594+
indices.delete_template:
1595+
name: '*'
1596+
ignore: 404
1597+
15911598
# First, make sure that validation fails before we create the index (since we are only defining to bar field but trying to index a value
15921599
# for foo.
15931600
- do:

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.create/10_basic.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,70 @@
149149
indices.exists_alias:
150150
name: logs_2022-12-31
151151
- is_true: ''
152+
153+
---
154+
"Create lookup index":
155+
- requires:
156+
test_runner_features: [ capabilities, default_shards ]
157+
capabilities:
158+
- method: PUT
159+
path: /{index}
160+
capabilities: [ lookup_index_mode ]
161+
reason: "Support for 'lookup' index mode capability required"
162+
- do:
163+
indices.create:
164+
index: "test_lookup"
165+
body:
166+
settings:
167+
index.mode: lookup
168+
169+
- do:
170+
indices.get_settings:
171+
index: test_lookup
172+
173+
- match: { test_lookup.settings.index.number_of_shards: "1"}
174+
- match: { test_lookup.settings.index.auto_expand_replicas: "0-all"}
175+
176+
---
177+
"Create lookup index with one shard":
178+
- requires:
179+
test_runner_features: [ capabilities, default_shards ]
180+
capabilities:
181+
- method: PUT
182+
path: /{index}
183+
capabilities: [ lookup_index_mode ]
184+
reason: "Support for 'lookup' index mode capability required"
185+
- do:
186+
indices.create:
187+
index: "test_lookup"
188+
body:
189+
settings:
190+
index:
191+
mode: lookup
192+
number_of_shards: 1
193+
194+
- do:
195+
indices.get_settings:
196+
index: test_lookup
197+
198+
- match: { test_lookup.settings.index.number_of_shards: "1"}
199+
- match: { test_lookup.settings.index.auto_expand_replicas: "0-all"}
200+
201+
---
202+
"Create lookup index with two shards":
203+
- requires:
204+
test_runner_features: [ capabilities ]
205+
capabilities:
206+
- method: PUT
207+
path: /{index}
208+
capabilities: [ lookup_index_mode ]
209+
reason: "Support for 'lookup' index mode capability required"
210+
- do:
211+
catch: /illegal_argument_exception/
212+
indices.create:
213+
index: test_lookup
214+
body:
215+
settings:
216+
index.mode: lookup
217+
index.number_of_shards: 2
218+

0 commit comments

Comments
 (0)