Skip to content

Commit 0ce58c5

Browse files
committed
Merge remote-tracking branch 'upstream/8.x' into 8.x
2 parents 5921869 + 1883db7 commit 0ce58c5

File tree

21 files changed

+269
-161
lines changed

21 files changed

+269
-161
lines changed

docs/changelog/115061.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 115061
2+
summary: "[ES|QL] Simplify syntax of named parameter for identifier and pattern"
3+
area: ES|QL
4+
type: bug
5+
issues: []

docs/changelog/115414.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
pr: 115414
2+
summary: Mitigate IOSession timeouts
3+
area: Machine Learning
4+
type: bug
5+
issues:
6+
- 114385
7+
- 114327
8+
- 114105
9+
- 114232

docs/reference/inference/inference-apis.asciidoc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,24 @@ Elastic –, then create an {infer} endpoint by the <<put-inference-api>>.
3434
Now use <<semantic-search-semantic-text, semantic text>> to perform
3535
<<semantic-search, semantic search>> on your data.
3636

37+
38+
[discrete]
39+
[[default-enpoints]]
40+
=== Default {infer} endpoints
41+
42+
Your {es} deployment contains some preconfigured {infer} endpoints that makes it easier for you to use them when defining `semantic_text` fields or {infer} processors.
43+
The following list contains the default {infer} endpoints listed by `inference_id`:
44+
45+
* `.elser-2-elasticsearch`: uses the {ml-docs}/ml-nlp-elser.html[ELSER] built-in trained model for `sparse_embedding` tasks (recommended for English language texts)
46+
* `.multilingual-e5-small-elasticsearch`: uses the {ml-docs}/ml-nlp-e5.html[E5] built-in trained model for `text_embedding` tasks (recommended for non-English language texts)
47+
48+
Use the `inference_id` of the endpoint in a <<semantic-text,`semantic_text`>> field definition or when creating an <<inference-processor,{infer} processor>>.
49+
The API call will automatically download and deploy the model which might take a couple of minutes.
50+
Default {infer} enpoints have {ml-docs}/ml-nlp-auto-scale.html#nlp-model-adaptive-allocations[adaptive allocations] enabled.
51+
For these models, the minimum number of allocations is `0`.
52+
If there is no {infer} activity that uses the endpoint, the number of allocations will scale down to `0` automatically after 15 minutes.
53+
54+
3755
include::delete-inference.asciidoc[]
3856
include::get-inference.asciidoc[]
3957
include::post-inference.asciidoc[]

docs/reference/inference/service-elasticsearch.asciidoc

Lines changed: 84 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
[[infer-service-elasticsearch]]
22
=== Elasticsearch {infer} service
33

4-
Creates an {infer} endpoint to perform an {infer} task with the `elasticsearch`
5-
service.
4+
Creates an {infer} endpoint to perform an {infer} task with the `elasticsearch` service.
65

7-
NOTE: If you use the E5 model through the `elasticsearch` service, the API
8-
request will automatically download and deploy the model if it isn't downloaded
9-
yet.
6+
NOTE: 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.
107

118

129
[discrete]
@@ -56,6 +53,11 @@ These settings are specific to the `elasticsearch` service.
5653
(Optional, object)
5754
include::{es-ref-dir}/ml/ml-shared.asciidoc[tag=adaptive-allocation]
5855

56+
`deployment_id`:::
57+
(Optional, string)
58+
The `deployment_id` of an existing trained model deployment.
59+
When `deployment_id` is used the `model_id` is optional.
60+
5961
`enabled`::::
6062
(Optional, Boolean)
6163
include::{es-ref-dir}/ml/ml-shared.asciidoc[tag=adaptive-allocation-enabled]
@@ -71,7 +73,7 @@ include::{es-ref-dir}/ml/ml-shared.asciidoc[tag=adaptive-allocation-min-number]
7173
`model_id`:::
7274
(Required, string)
7375
The name of the model to use for the {infer} task.
74-
It can be the ID of either a built-in model (for example, `.multilingual-e5-small` for E5) or a text embedding model already
76+
It can be the ID of either a built-in model (for example, `.multilingual-e5-small` for E5), a text embedding model already
7577
{ml-docs}/ml-nlp-import-model.html#ml-nlp-import-script[uploaded through Eland].
7678

7779
`num_allocations`:::
@@ -98,15 +100,44 @@ Returns the document instead of only the index. Defaults to `true`.
98100
=====
99101

100102

103+
[discrete]
104+
[[inference-example-elasticsearch-elser]]
105+
==== ELSER via the `elasticsearch` service
106+
107+
The following example shows how to create an {infer} endpoint called `my-elser-model` to perform a `sparse_embedding` task type.
108+
109+
The API request below will automatically download the ELSER model if it isn't already downloaded and then deploy the model.
110+
111+
[source,console]
112+
------------------------------------------------------------
113+
PUT _inference/sparse_embedding/my-elser-model
114+
{
115+
"service": "elasticsearch",
116+
"service_settings": {
117+
"adaptive_allocations": { <1>
118+
"enabled": true,
119+
"min_number_of_allocations": 1,
120+
"max_number_of_allocations": 10
121+
},
122+
"num_threads": 1,
123+
"model_id": ".elser_model_2" <2>
124+
}
125+
}
126+
------------------------------------------------------------
127+
// TEST[skip:TBD]
128+
<1> Adaptive allocations will be enabled with the minimum of 1 and the maximum of 10 allocations.
129+
<2> The `model_id` must be the ID of one of the built-in ELSER models.
130+
Valid values are `.elser_model_2` and `.elser_model_2_linux-x86_64`.
131+
For further details, refer to the {ml-docs}/ml-nlp-elser.html[ELSER model documentation].
132+
133+
101134
[discrete]
102135
[[inference-example-elasticsearch]]
103136
==== E5 via the `elasticsearch` service
104137

105-
The following example shows how to create an {infer} endpoint called
106-
`my-e5-model` to perform a `text_embedding` task type.
138+
The following example shows how to create an {infer} endpoint called `my-e5-model` to perform a `text_embedding` task type.
107139

108-
The API request below will automatically download the E5 model if it isn't
109-
already downloaded and then deploy the model.
140+
The API request below will automatically download the E5 model if it isn't already downloaded and then deploy the model.
110141

111142
[source,console]
112143
------------------------------------------------------------
@@ -185,3 +216,46 @@ PUT _inference/text_embedding/my-e5-model
185216
}
186217
------------------------------------------------------------
187218
// TEST[skip:TBD]
219+
220+
221+
[discrete]
222+
[[inference-example-existing-deployment]]
223+
==== Using an existing model deployment with the `elasticsearch` service
224+
225+
The following example shows how to use an already existing model deployment when creating an {infer} endpoint.
226+
227+
[source,console]
228+
------------------------------------------------------------
229+
PUT _inference/sparse_embedding/use_existing_deployment
230+
{
231+
"service": "elasticsearch",
232+
"service_settings": {
233+
"deployment_id": ".elser_model_2" <1>
234+
}
235+
}
236+
------------------------------------------------------------
237+
// TEST[skip:TBD]
238+
<1> The `deployment_id` of the already existing model deployment.
239+
240+
The API response contains the `model_id`, and the threads and allocations settings from the model deployment:
241+
242+
[source,console-result]
243+
------------------------------------------------------------
244+
{
245+
"inference_id": "use_existing_deployment",
246+
"task_type": "sparse_embedding",
247+
"service": "elasticsearch",
248+
"service_settings": {
249+
"num_allocations": 2,
250+
"num_threads": 1,
251+
"model_id": ".elser_model_2",
252+
"deployment_id": ".elser_model_2"
253+
},
254+
"chunking_settings": {
255+
"strategy": "sentence",
256+
"max_chunk_size": 250,
257+
"sentence_overlap": 1
258+
}
259+
}
260+
------------------------------------------------------------
261+
// NOTCONSOLE

docs/reference/inference/service-elser.asciidoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
=== ELSER {infer} service
33

44
Creates an {infer} endpoint to perform an {infer} task with the `elser` service.
5+
You can also deploy ELSER by using the <<infer-service-elasticsearch>>.
56

67
NOTE: The API request will automatically download and deploy the ELSER model if
78
it isn't already downloaded.
@@ -128,7 +129,7 @@ If using the Python client, you can set the `timeout` parameter to a higher valu
128129

129130
[discrete]
130131
[[inference-example-elser-adaptive-allocation]]
131-
==== Setting adaptive allocation for the ELSER service
132+
==== Setting adaptive allocations for the ELSER service
132133

133134
NOTE: For more information on how to optimize your ELSER endpoints, refer to {ml-docs}/ml-nlp-elser.html#elser-recommendations[the ELSER recommendations] section in the model documentation.
134135
To learn more about model autoscaling, refer to the {ml-docs}/ml-nlp-auto-scale.html[trained model autoscaling] page.

docs/reference/query-dsl/terms-set-query.asciidoc

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,22 @@ GET /job-candidates/_search
159159
`terms`::
160160
+
161161
--
162-
(Required, array of strings) Array of terms you wish to find in the provided
162+
(Required, array) Array of terms you wish to find in the provided
163163
`<field>`. To return a document, a required number of terms must exactly match
164164
the field values, including whitespace and capitalization.
165165

166-
The required number of matching terms is defined in the
167-
`minimum_should_match_field` or `minimum_should_match_script` parameter.
166+
The required number of matching terms is defined in the `minimum_should_match`,
167+
`minimum_should_match_field` or `minimum_should_match_script` parameters. Exactly
168+
one of these parameters must be provided.
169+
--
170+
171+
`minimum_should_match`::
172+
+
173+
--
174+
(Optional) Specification for the number of matching terms required to return
175+
a document.
176+
177+
For valid values, see <<query-dsl-minimum-should-match, `minimum_should_match` parameter>>.
168178
--
169179

170180
`minimum_should_match_field`::

muted-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,9 @@ tests:
369369
- class: org.elasticsearch.xpack.core.ml.calendars.ScheduledEventTests
370370
method: testBuild_SucceedsWithDefaultSkipResultAndSkipModelUpdatesValues
371371
issue: https://github.com/elastic/elasticsearch/issues/115476
372+
- class: org.elasticsearch.reservedstate.service.FileSettingsServiceTests
373+
method: testProcessFileChanges
374+
issue: https://github.com/elastic/elasticsearch/issues/115280
372375

373376
# Examples:
374377
#

x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/RestEsqlTestCase.java

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ public void testErrorMessageForArrayValuesInParams() throws IOException {
673673
public void testNamedParamsForIdentifierAndIdentifierPatterns() throws IOException {
674674
assumeTrue(
675675
"named parameters for identifiers and patterns require snapshot build",
676-
EsqlCapabilities.Cap.NAMED_PARAMETER_FOR_FIELD_AND_FUNCTION_NAMES.isEnabled()
676+
EsqlCapabilities.Cap.NAMED_PARAMETER_FOR_FIELD_AND_FUNCTION_NAMES_SIMPLIFIED_SYNTAX.isEnabled()
677677
);
678678
bulkLoadTestData(10);
679679
// positive
@@ -685,12 +685,9 @@ public void testNamedParamsForIdentifierAndIdentifierPatterns() throws IOExcepti
685685
)
686686
)
687687
.params(
688-
"[{\"n1\" : {\"value\" : \"integer\" , \"kind\" : \"identifier\"}},"
689-
+ "{\"n2\" : {\"value\" : \"short\" , \"kind\" : \"identifier\"}}, "
690-
+ "{\"n3\" : {\"value\" : \"double\" , \"kind\" : \"identifier\"}},"
691-
+ "{\"n4\" : {\"value\" : \"boolean\" , \"kind\" : \"identifier\"}}, "
692-
+ "{\"n5\" : {\"value\" : \"xx*\" , \"kind\" : \"pattern\"}}, "
693-
+ "{\"fn1\" : {\"value\" : \"max\" , \"kind\" : \"identifier\"}}]"
688+
"[{\"n1\" : {\"identifier\" : \"integer\"}}, {\"n2\" : {\"identifier\" : \"short\"}}, "
689+
+ "{\"n3\" : {\"identifier\" : \"double\"}}, {\"n4\" : {\"identifier\" : \"boolean\"}}, "
690+
+ "{\"n5\" : {\"pattern\" : \"xx*\"}}, {\"fn1\" : {\"identifier\" : \"max\"}}]"
694691
);
695692
Map<String, Object> result = runEsql(query);
696693
Map<String, String> colA = Map.of("name", "boolean", "type", "boolean");
@@ -729,10 +726,7 @@ public void testNamedParamsForIdentifierAndIdentifierPatterns() throws IOExcepti
729726
ResponseException.class,
730727
() -> runEsqlSync(
731728
requestObjectBuilder().query(format(null, "from {} | {}", testIndexName(), command.getKey()))
732-
.params(
733-
"[{\"n1\" : {\"value\" : \"integer\" , \"kind\" : \"identifier\"}},"
734-
+ "{\"n2\" : {\"value\" : \"short\" , \"kind\" : \"identifier\"}}]"
735-
)
729+
.params("[{\"n1\" : {\"identifier\" : \"integer\"}}, {\"n2\" : {\"identifier\" : \"short\"}}]")
736730
)
737731
);
738732
error = re.getMessage();
@@ -752,9 +746,8 @@ public void testNamedParamsForIdentifierAndIdentifierPatterns() throws IOExcepti
752746
() -> runEsqlSync(
753747
requestObjectBuilder().query(format(null, "from {} | {}", testIndexName(), command.getKey()))
754748
.params(
755-
"[{\"n1\" : {\"value\" : \"`n1`\" , \"kind\" : \"identifier\"}},"
756-
+ "{\"n2\" : {\"value\" : \"`n2`\" , \"kind\" : \"identifier\"}}, "
757-
+ "{\"n3\" : {\"value\" : \"`n3`\" , \"kind\" : \"identifier\"}}]"
749+
"[{\"n1\" : {\"identifier\" : \"`n1`\"}}, {\"n2\" : {\"identifier\" : \"`n2`\"}}, "
750+
+ "{\"n3\" : {\"identifier\" : \"`n3`\"}}]"
758751
)
759752
)
760753
);
@@ -782,7 +775,7 @@ public void testNamedParamsForIdentifierAndIdentifierPatterns() throws IOExcepti
782775
ResponseException.class,
783776
() -> runEsqlSync(
784777
requestObjectBuilder().query(format(null, "from {} | ?cmd {}", testIndexName(), command.getValue()))
785-
.params("[{\"cmd\" : {\"value\" : \"" + command.getKey() + "\", \"kind\" : \"identifier\"}}]")
778+
.params("[{\"cmd\" : {\"identifier\" : \"" + command.getKey() + "\"}}]")
786779
)
787780
);
788781
error = re.getMessage();

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -378,11 +378,6 @@ public enum Cap {
378378
*/
379379
DATE_DIFF_YEAR_CALENDARIAL,
380380

381-
/**
382-
* Support named parameters for field names.
383-
*/
384-
NAMED_PARAMETER_FOR_FIELD_AND_FUNCTION_NAMES(Build.current().isSnapshot()),
385-
386381
/**
387382
* Fix sorting not allowed on _source and counters.
388383
*/
@@ -425,7 +420,12 @@ public enum Cap {
425420
/**
426421
* This enables 60_usage.yml "Basic ESQL usage....non-snapshot" version test. See also the previous capability.
427422
*/
428-
NON_SNAPSHOT_TEST_FOR_TELEMETRY(Build.current().isSnapshot() == false);
423+
NON_SNAPSHOT_TEST_FOR_TELEMETRY(Build.current().isSnapshot() == false),
424+
425+
/**
426+
* Support simplified syntax for named parameters for field and function names.
427+
*/
428+
NAMED_PARAMETER_FOR_FIELD_AND_FUNCTION_NAMES_SIMPLIFIED_SYNTAX(Build.current().isSnapshot());
429429

430430
private final boolean enabled;
431431

0 commit comments

Comments
 (0)