Skip to content

Commit 29dae8a

Browse files
authored
Merge branch 'main' into markjhoy/default_token_pruning_sparse_vector
2 parents 6c5e253 + 2b5851b commit 29dae8a

File tree

31 files changed

+198
-358
lines changed

31 files changed

+198
-358
lines changed

docs/changelog/126805.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 126805
2+
summary: Adding timeout to request for creating inference endpoint
3+
area: Machine Learning
4+
type: bug
5+
issues: []

docs/reference/elasticsearch/mapping-reference/keyword.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,42 @@ Will become:
232232
}
233233
```
234234

235+
If `null_value` is configured, `null` values are replaced with the `null_value` in synthetic source:
236+
237+
$$$synthetic-source-keyword-example-null-value$$$
238+
239+
```console
240+
PUT idx
241+
{
242+
"settings": {
243+
"index": {
244+
"mapping": {
245+
"source": {
246+
"mode": "synthetic"
247+
}
248+
}
249+
}
250+
},
251+
"mappings": {
252+
"properties": {
253+
"kwd": { "type": "keyword", "null_value": "NA" }
254+
}
255+
}
256+
}
257+
PUT idx/_doc/1
258+
{
259+
"kwd": ["foo", null, "bar"]
260+
}
261+
```
262+
263+
Will become:
264+
265+
```console-result
266+
{
267+
"kwd": ["bar", "foo", "NA"]
268+
}
269+
```
270+
235271

236272
## Constant keyword field type [constant-keyword-field-type]
237273

docs/reference/elasticsearch/mapping-reference/text.md

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,17 @@ Synthetic `_source` is Generally Available only for TSDB indices (indices that h
104104
::::
105105

106106

107-
`text` fields support [synthetic `_source`](/reference/elasticsearch/mapping-reference/mapping-source-field.md#synthetic-source) if they have a [`keyword`](/reference/elasticsearch/mapping-reference/keyword.md#keyword-synthetic-source) sub-field that supports synthetic `_source` or if the `text` field sets `store` to `true`. Either way, it may not have [`copy_to`](/reference/elasticsearch/mapping-reference/copy-to.md).
107+
`text` fields can use a [`keyword`](/reference/elasticsearch/mapping-reference/keyword.md#keyword-synthetic-source) sub-field to support [synthetic `_source`](/reference/elasticsearch/mapping-reference/mapping-source-field.md#synthetic-source) without storing values of the text field itself.
108108

109-
If using a sub-`keyword` field, then the values are sorted in the same way as a `keyword` field’s values are sorted. By default, that means sorted with duplicates removed. So:
109+
In this case, the synthetic source of the `text` field will have the same [modifications](/reference/elasticsearch/mapping-reference/mapping-source-field.md#synthetic-source) as a `keyword` field.
110110

111-
$$$synthetic-source-text-example-default$$$
111+
These modifications can impact usage of `text` fields:
112+
* Reordering text fields can have an effect on [phrase](/reference/query-languages/query-dsl/query-dsl-match-query-phrase.md) and [span](/reference/query-languages/query-dsl/span-queries.md) queries. See the discussion about [`position_increment_gap`](/reference/elasticsearch/mapping-reference/position-increment-gap.md) for more details. You can avoid this by making sure the `slop` parameter on the phrase queries is lower than the `position_increment_gap`. This is the default.
113+
* Handling of `null` values is different. `text` fields ignore `null` values, but `keyword` fields support replacing `null` values with a value specified in the `null_value` parameter. This replacement is represented in synthetic source.
114+
115+
For example:
116+
117+
$$$synthetic-source-text-example-multi-field$$$
112118

113119
```console
114120
PUT idx
@@ -127,8 +133,9 @@ PUT idx
127133
"text": {
128134
"type": "text",
129135
"fields": {
130-
"raw": {
131-
"type": "keyword"
136+
"kwd": {
137+
"type": "keyword",
138+
"null_value": "NA"
132139
}
133140
}
134141
}
@@ -138,9 +145,10 @@ PUT idx
138145
PUT idx/_doc/1
139146
{
140147
"text": [
148+
null,
141149
"the quick brown fox",
142150
"the quick brown fox",
143-
"jumped over the lazy dog"
151+
"jumped over the lazy dog",
144152
]
145153
}
146154
```
@@ -150,18 +158,15 @@ Will become:
150158
```console-result
151159
{
152160
"text": [
153-
"jumped over the lazy dog",
161+
"jumped over the lazy dog"
162+
"NA",
154163
"the quick brown fox"
155164
]
156165
}
157166
```
158167

159-
::::{note}
160-
Reordering text fields can have an effect on [phrase](/reference/query-languages/query-dsl/query-dsl-match-query-phrase.md) and [span](/reference/query-languages/query-dsl/span-queries.md) queries. See the discussion about [`position_increment_gap`](/reference/elasticsearch/mapping-reference/position-increment-gap.md) for more detail. You can avoid this by making sure the `slop` parameter on the phrase queries is lower than the `position_increment_gap`. This is the default.
161-
::::
162168

163-
164-
If the `text` field sets `store` to true then order and duplicates are preserved.
169+
If the `text` field sets `store` to `true` then the sub-field is not used and no modifications are applied. For example:
165170

166171
$$$synthetic-source-text-example-stored$$$
167172

@@ -179,7 +184,15 @@ PUT idx
179184
},
180185
"mappings": {
181186
"properties": {
182-
"text": { "type": "text", "store": true }
187+
"text": {
188+
"type": "text",
189+
"store": true,
190+
"fields": {
191+
"raw": {
192+
"type": "keyword"
193+
}
194+
}
195+
}
183196
}
184197
}
185198
}

docs/release-notes/breaking-changes.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ If you are migrating from a version prior to version 9.0, you must first upgrade
1313
% ## Next version [elasticsearch-nextversion-breaking-changes]
1414

1515
## 9.0.1 [elasticsearch-9.0.1-breaking-changes]
16-
```{applies_to}
17-
stack: coming 9.0.1
18-
```
1916

2017
No breaking changes in this version.
2118

docs/release-notes/deprecations.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ To give you insight into what deprecated features you’re using, {{es}}:
1717
% ## Next version [elasticsearch-nextversion-deprecations]
1818

1919
## 9.0.1 [elasticsearch-9.0.1-deprecations]
20-
```{applies_to}
21-
stack: coming 9.0.1
22-
```
2320

2421
No deprecations in this version.
2522

docs/release-notes/index.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ To check for security updates, go to [Security announcements for the Elastic sta
2121
% *
2222

2323
## 9.0.1 [elasticsearch-9.0.1-release-notes]
24-
```{applies_to}
25-
stack: coming 9.0.1
26-
```
2724

2825
### Features and enhancements [elasticsearch-9.0.1-features-enhancements]
2926

muted-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,9 @@ tests:
441441
- class: org.elasticsearch.xpack.esql.optimizer.OptimizerRulesTests
442442
method: testOptimizerExpressionRuleShouldNotVisitExcludedNodes
443443
issue: https://github.com/elastic/elasticsearch/issues/127754
444+
- class: org.elasticsearch.xpack.remotecluster.RemoteClusterSecurityFcActionAuthorizationIT
445+
method: testIndicesPrivilegesAreEnforcedForCcrRestoreSessionActions
446+
issue: https://github.com/elastic/elasticsearch/issues/127782
444447

445448
# Examples:
446449
#

server/src/main/java/org/elasticsearch/TransportVersions.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ static TransportVersion def(int id) {
172172
public static final TransportVersion INTRODUCE_FAILURES_LIFECYCLE_BACKPORT_8_19 = def(8_841_0_25);
173173
public static final TransportVersion INTRODUCE_FAILURES_DEFAULT_RETENTION_BACKPORT_8_19 = def(8_841_0_26);
174174
public static final TransportVersion RESCORE_VECTOR_ALLOW_ZERO_BACKPORT_8_19 = def(8_841_0_27);
175-
public static final TransportVersion SPARSE_VECTOR_FIELD_PRUNING_OPTIONS_8_19 = def(8_841_0_28);
175+
public static final TransportVersion INFERENCE_ADD_TIMEOUT_PUT_ENDPOINT_8_19 = def(8_841_0_28);
176+
public static final TransportVersion SPARSE_VECTOR_FIELD_PRUNING_OPTIONS_8_19 = def(8_841_0_29);
176177
public static final TransportVersion V_9_0_0 = def(9_000_0_09);
177178
public static final TransportVersion INITIAL_ELASTICSEARCH_9_0_1 = def(9_000_0_10);
178179
public static final TransportVersion INITIAL_ELASTICSEARCH_9_0_2 = def(9_000_0_11);
@@ -249,7 +250,8 @@ static TransportVersion def(int id) {
249250
public static final TransportVersion INTRODUCE_FAILURES_DEFAULT_RETENTION = def(9_071_0_00);
250251
public static final TransportVersion FILE_SETTINGS_HEALTH_INFO = def(9_072_0_00);
251252
public static final TransportVersion FIELD_CAPS_ADD_CLUSTER_ALIAS = def(9_073_0_00);
252-
public static final TransportVersion SPARSE_VECTOR_FIELD_PRUNING_OPTIONS = def(9_074_0_00);
253+
public static final TransportVersion INFERENCE_ADD_TIMEOUT_PUT_ENDPOINT = def(9_074_00_0);
254+
public static final TransportVersion SPARSE_VECTOR_FIELD_PRUNING_OPTIONS = def(9_075_0_00);
253255

254256
/*
255257
* STOP! READ THIS FIRST! No, really,

server/src/main/java/org/elasticsearch/action/search/SearchQueryThenFetchAsyncAction.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import org.elasticsearch.action.support.IndicesOptions;
2424
import org.elasticsearch.client.internal.Client;
2525
import org.elasticsearch.cluster.ClusterState;
26-
import org.elasticsearch.common.bytes.ReleasableBytesReference;
2726
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
2827
import org.elasticsearch.common.io.stream.RecyclerBytesStreamOutput;
2928
import org.elasticsearch.common.io.stream.StreamInput;
@@ -820,7 +819,7 @@ void onShardDone() {
820819
out.close();
821820
}
822821
}
823-
ActionListener.respondAndRelease(channelListener, new BytesTransportResponse(new ReleasableBytesReference(out.bytes(), out)));
822+
ActionListener.respondAndRelease(channelListener, new BytesTransportResponse(out.moveToBytesReference()));
824823
}
825824

826825
private void maybeFreeContext(SearchPhaseResult result, BitSet relevantShardIndices) {

server/src/main/java/org/elasticsearch/cluster/coordination/JoinValidationService.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,7 @@ private ReleasableBytesReference maybeSerializeClusterState(
391391
}
392392
assert clusterState.nodes().isLocalNodeElectedMaster();
393393

394-
final var bytesStream = transportService.newNetworkBytesStream();
395-
var success = false;
396-
try {
394+
try (var bytesStream = transportService.newNetworkBytesStream()) {
397395
try (
398396
var stream = new OutputStreamStreamOutput(
399397
CompressorFactory.COMPRESSOR.threadLocalOutputStream(Streams.flushOnCloseStream(bytesStream))
@@ -404,22 +402,16 @@ private ReleasableBytesReference maybeSerializeClusterState(
404402
} catch (IOException e) {
405403
throw new ElasticsearchException("failed to serialize cluster state for publishing to node {}", e, discoveryNode);
406404
}
407-
final var newBytes = new ReleasableBytesReference(bytesStream.bytes(), bytesStream);
408405
logger.trace(
409406
"serialized join validation cluster state version [{}] for transport version [{}] with size [{}]",
410407
clusterState.version(),
411408
version,
412-
newBytes.length()
409+
bytesStream.position()
413410
);
411+
var newBytes = bytesStream.moveToBytesReference();
414412
final var previousBytes = statesByVersion.put(version, newBytes);
415413
assert previousBytes == null;
416-
success = true;
417414
return newBytes;
418-
} finally {
419-
if (success == false) {
420-
bytesStream.close();
421-
assert false;
422-
}
423415
}
424416
}
425417
}

0 commit comments

Comments
 (0)