Skip to content

Commit 7131b30

Browse files
authored
Merge branch 'main' into kderusso/text-similarity-reranking-now-with-chunks
2 parents 9d35f6c + 222cae0 commit 7131b30

File tree

9 files changed

+139
-259
lines changed

9 files changed

+139
-259
lines changed

docs/changelog/134091.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 134091
2+
summary: Use latest setting value when initializing setting watch
3+
area: Infra/Settings
4+
type: bug
5+
issues:
6+
- 133701

docs/reference/query-languages/esql/_snippets/operators/layout/rlike.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
:class: text-center
66
:::
77

8-
Use `RLIKE` to filter data based on string patterns using using [regular expressions](/reference/query-languages/query-dsl/regexp-syntax.md). `RLIKE` usually acts on a field placed on the left-hand side of the operator, but it can also act on a constant (literal) expression. The right-hand side of the operator represents the pattern.
8+
Use `RLIKE` to filter data based on string patterns using [regular expressions](/reference/query-languages/query-dsl/regexp-syntax.md). `RLIKE` usually acts on a field placed on the left-hand side of the operator, but it can also act on a constant (literal) expression. The right-hand side of the operator represents the pattern.
99

1010
:::{include} ../types/rlike.md
1111
:::

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,6 @@ static TransportVersion def(int id) {
327327
public static final TransportVersion ESQL_SPLIT_ON_BIG_VALUES_9_1 = def(9_112_0_01);
328328
public static final TransportVersion ESQL_FIXED_INDEX_LIKE_9_1 = def(9_112_0_02);
329329
public static final TransportVersion ESQL_SAMPLE_OPERATOR_STATUS_9_1 = def(9_112_0_03);
330-
public static final TransportVersion INITIAL_ELASTICSEARCH_9_1_1 = def(9_112_0_04);
331-
public static final TransportVersion INITIAL_ELASTICSEARCH_9_1_2 = def(9_112_0_05);
332330
public static final TransportVersion INITIAL_ELASTICSEARCH_9_1_4 = def(9_112_0_07);
333331
public static final TransportVersion PROJECT_STATE_REGISTRY_RECORDS_DELETIONS = def(9_113_0_00);
334332
public static final TransportVersion ESQL_SERIALIZE_TIMESERIES_FIELD_TYPE = def(9_114_0_00);

server/src/main/java/org/elasticsearch/common/settings/AbstractScopedSettings.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,11 @@ public synchronized <T> void initializeAndWatch(Setting<T> setting, Consumer<T>
433433
assert setting.getProperties().contains(Setting.Property.Dynamic)
434434
|| setting.getProperties().contains(Setting.Property.OperatorDynamic) : "Can only watch dynamic settings";
435435
assert setting.getProperties().contains(Setting.Property.NodeScope) : "Can only watch node settings";
436-
consumer.accept(setting.get(settings));
436+
437+
// this mimics the combined settings of last applied and node settings, without building a new settings object
438+
Settings settingsWithValue = setting.exists(lastSettingsApplied) ? lastSettingsApplied : settings;
439+
440+
consumer.accept(setting.get(settingsWithValue));
437441
addSettingsUpdateConsumer(setting, consumer);
438442
}
439443

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9112004
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9112005
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
package org.elasticsearch.action.admin.cluster.settings;
11+
12+
import org.elasticsearch.common.settings.ClusterSettings;
13+
import org.elasticsearch.common.settings.Setting;
14+
import org.elasticsearch.common.settings.Settings;
15+
import org.elasticsearch.test.ESTestCase;
16+
17+
import java.util.Set;
18+
19+
import static org.hamcrest.Matchers.equalTo;
20+
21+
public class ClusterSettingsTests extends ESTestCase {
22+
23+
public void testWatchAfterApply() {
24+
Setting<String> clusterSetting = Setting.simpleString("cluster.setting", Setting.Property.NodeScope, Setting.Property.Dynamic);
25+
Settings nodeSettings = Settings.builder().put("cluster.setting", "initial_value").build();
26+
27+
ClusterSettings clusterSettings = new ClusterSettings(nodeSettings, Set.of(clusterSetting));
28+
Settings newSettings = Settings.builder().put("cluster.setting", "updated_value").build();
29+
clusterSettings.applySettings(newSettings);
30+
31+
// the value should be current when initializing the consumer
32+
clusterSettings.initializeAndWatch(clusterSetting, value -> { assertThat(value, equalTo("updated_value")); });
33+
}
34+
}

x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/TimeSeriesRestDriver.java

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import java.util.concurrent.TimeUnit;
5151

5252
import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS;
53+
import static org.elasticsearch.test.ESTestCase.assertThat;
5354
import static org.elasticsearch.test.ESTestCase.randomAlphaOfLengthBetween;
5455
import static org.elasticsearch.test.ESTestCase.randomBoolean;
5556
import static org.elasticsearch.test.ESTestCase.waitUntil;
@@ -59,8 +60,6 @@
5960
import static org.elasticsearch.xpack.core.ilm.ShrinkIndexNameSupplier.SHRUNKEN_INDEX_PREFIX;
6061
import static org.hamcrest.Matchers.anyOf;
6162
import static org.hamcrest.Matchers.equalTo;
62-
import static org.hamcrest.Matchers.is;
63-
import static org.junit.Assert.assertThat;
6463

6564
/**
6665
* This class provides the operational REST functions needed to control an ILM time series lifecycle.
@@ -80,7 +79,7 @@ public static Step.StepKey getStepKeyForIndex(RestClient client, String indexNam
8079
return getStepKey(indexResponse);
8180
}
8281

83-
private static Step.StepKey getStepKey(Map<String, Object> explainIndexResponse) {
82+
public static Step.StepKey getStepKey(Map<String, Object> explainIndexResponse) {
8483
String phase = (String) explainIndexResponse.get("phase");
8584
String action = (String) explainIndexResponse.get("action");
8685
String step = (String) explainIndexResponse.get("step");
@@ -105,14 +104,26 @@ public static Map<String, Map<String, Object>> explain(RestClient client, String
105104
explainRequest.addParameter("only_managed", Boolean.toString(onlyManaged));
106105
explainRequest.setOptions(consumeWarningsOptions);
107106
Response response = client.performRequest(explainRequest);
108-
Map<String, Object> responseMap;
109-
try (InputStream is = response.getEntity().getContent()) {
110-
responseMap = XContentHelper.convertToMap(XContentType.JSON.xContent(), is, true);
111-
}
107+
ObjectPath objectPath = ObjectPath.createFromResponse(response);
108+
return objectPath.evaluate("indices");
109+
}
112110

113-
@SuppressWarnings("unchecked")
114-
Map<String, Map<String, Object>> indexResponse = ((Map<String, Map<String, Object>>) responseMap.get("indices"));
115-
return indexResponse;
111+
/**
112+
* Waits until the specified index is at the specified ILM step. If any of phase, action, or step is null, that part is ignored.
113+
*/
114+
public static void awaitStepKey(RestClient client, String indexName, String phase, String action, String step) throws Exception {
115+
ESRestTestCase.assertBusy(() -> {
116+
final Step.StepKey stepKey = getStepKeyForIndex(client, indexName);
117+
if (phase != null) {
118+
assertThat(stepKey.phase(), equalTo(phase));
119+
}
120+
if (action != null) {
121+
assertThat(stepKey.action(), equalTo(action));
122+
}
123+
if (step != null) {
124+
assertThat(stepKey.name(), equalTo(step));
125+
}
126+
});
116127
}
117128

118129
public static void indexDocument(RestClient client, String indexAbstractionName) throws IOException {
@@ -501,24 +512,6 @@ public static String waitAndGetShrinkIndexName(RestClient client, String origina
501512
return shrunkenIndexName[0];
502513
}
503514

504-
@SuppressWarnings("unchecked")
505-
public static List<String> getBackingIndices(RestClient client, String dataStreamName) throws IOException {
506-
Response getDataStream = client.performRequest(new Request("GET", "_data_stream/" + dataStreamName));
507-
Map<String, Object> responseMap;
508-
try (InputStream is = getDataStream.getEntity().getContent()) {
509-
responseMap = XContentHelper.convertToMap(XContentType.JSON.xContent(), is, true);
510-
}
511-
512-
List<Map<String, Object>> dataStreams = (List<Map<String, Object>>) responseMap.get("data_streams");
513-
assertThat(dataStreams.size(), is(1));
514-
Map<String, Object> dataStream = dataStreams.get(0);
515-
assertThat(dataStream.get("name"), is(dataStreamName));
516-
List<String> indices = ((List<Map<String, Object>>) dataStream.get("indices")).stream()
517-
.map(indexMap -> (String) indexMap.get("index_name"))
518-
.toList();
519-
return indices;
520-
}
521-
522515
private static void executeDummyClusterStateUpdate(RestClient client) throws IOException {
523516
createIndexWithSettings(
524517
client,

0 commit comments

Comments
 (0)