Skip to content

Commit a1ea855

Browse files
authored
Merge branch 'main' into cleanup_semantic_text
2 parents b992dca + 540f90e commit a1ea855

File tree

36 files changed

+1491
-767
lines changed

36 files changed

+1491
-767
lines changed

build.gradle

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,16 @@ allprojects {
295295
tasks.register('resolveAllDependencies', ResolveAllDependencies) {
296296
def ignoredPrefixes = [DistributionDownloadPlugin.ES_DISTRO_CONFIG_PREFIX, "jdbcDriver"]
297297
configs = project.configurations.matching { config -> ignoredPrefixes.any { config.name.startsWith(it) } == false }
298-
resolveJavaToolChain = true
298+
if(project.path == ':') {
299+
resolveJavaToolChain = true
300+
301+
// ensure we have best possible caching of bwc builds
302+
dependsOn ":distribution:bwc:bugfix:buildBwcLinuxTar"
303+
dependsOn ":distribution:bwc:bugfix2:buildBwcLinuxTar"
304+
dependsOn ":distribution:bwc:minor:buildBwcLinuxTar"
305+
dependsOn ":distribution:bwc:staged:buildBwcLinuxTar"
306+
dependsOn ":distribution:bwc:staged2:buildBwcLinuxTar"
307+
}
299308
if (project.path.contains("fixture")) {
300309
dependsOn tasks.withType(ComposePull)
301310
}
@@ -306,6 +315,7 @@ allprojects {
306315
// ensure we resolve p2 dependencies for the spotless eclipse formatter
307316
dependsOn "spotlessJavaCheck"
308317
}
318+
309319
}
310320

311321
ext.withReleaseBuild = { Closure config ->

docs/reference/query-languages/query-dsl/query-dsl-knn-query.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ POST my-image-index/_search
206206

207207
A sample query can look like below:
208208

209-
```js
209+
```json
210210
{
211211
"query" : {
212212
"nested" : {
@@ -226,6 +226,7 @@ A sample query can look like below:
226226
}
227227
```
228228

229+
Note that nested `knn` only supports `score_mode=max`.
229230

230231
## Knn query with aggregations [knn-query-aggregations]
231232

docs/reference/query-languages/query-dsl/query-dsl-nested-query.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ See [Multi-level nested queries](#multi-level-nested-query-ex) for an example.
7171

7272

7373
`score_mode`
74-
: (Optional, string) Indicates how scores for matching child objects affect the root parent document’s [relevance score](/reference/query-languages/query-dsl/query-filter-context.md#relevance-scores). Valid values are:
74+
: (Optional, string) Indicates how scores for matching child objects affect the root parent document’s [relevance score](/reference/query-languages/query-dsl/query-filter-context.md#relevance-scores). Default is `avg`, but nested `knn` queries only support `score_mode=max`. Valid values are:
7575

7676
`avg` (Default)
7777
: Use the mean relevance score of all matching child objects.

modules/data-streams/src/internalClusterTest/java/org/elasticsearch/datastreams/DataStreamIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1400,7 +1400,7 @@ public void testGetDataStream() throws Exception {
14001400
assertThat(metricsFooDataStream.getDataStreamStatus(), is(ClusterHealthStatus.YELLOW));
14011401
assertThat(metricsFooDataStream.getIndexTemplate(), is("template_for_foo"));
14021402
assertThat(metricsFooDataStream.getIlmPolicy(), is(nullValue()));
1403-
assertThat(dataStream.getLifecycle(), is(lifecycle.toDataStreamLifecycle()));
1403+
assertThat(dataStream.getDataLifecycle(), is(lifecycle.toDataStreamLifecycle()));
14041404
assertThat(metricsFooDataStream.templatePreferIlmValue(), is(true));
14051405
GetDataStreamAction.Response.IndexProperties indexProperties = metricsFooDataStream.getIndexSettingsValues()
14061406
.get(dataStream.getWriteIndex());

modules/data-streams/src/internalClusterTest/java/org/elasticsearch/datastreams/lifecycle/ExplainDataStreamLifecycleIT.java

Lines changed: 31 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import org.elasticsearch.action.bulk.BulkRequest;
1919
import org.elasticsearch.action.bulk.BulkResponse;
2020
import org.elasticsearch.action.datastreams.CreateDataStreamAction;
21-
import org.elasticsearch.action.datastreams.GetDataStreamAction;
2221
import org.elasticsearch.action.datastreams.lifecycle.ExplainDataStreamLifecycleAction;
2322
import org.elasticsearch.action.datastreams.lifecycle.ExplainIndexDataStreamLifecycle;
2423
import org.elasticsearch.action.index.IndexRequest;
@@ -31,7 +30,6 @@
3130
import org.elasticsearch.core.Nullable;
3231
import org.elasticsearch.core.TimeValue;
3332
import org.elasticsearch.datastreams.DataStreamsPlugin;
34-
import org.elasticsearch.index.Index;
3533
import org.elasticsearch.index.mapper.DateFieldMapper;
3634
import org.elasticsearch.plugins.Plugin;
3735
import org.elasticsearch.rest.RestStatus;
@@ -99,29 +97,16 @@ public void testExplainLifecycle() throws Exception {
9997

10098
indexDocs(dataStreamName, 1);
10199

102-
assertBusy(() -> {
103-
GetDataStreamAction.Request getDataStreamRequest = new GetDataStreamAction.Request(
104-
TEST_REQUEST_TIMEOUT,
105-
new String[] { dataStreamName }
106-
);
107-
GetDataStreamAction.Response getDataStreamResponse = client().execute(GetDataStreamAction.INSTANCE, getDataStreamRequest)
108-
.actionGet();
109-
assertThat(getDataStreamResponse.getDataStreams().size(), equalTo(1));
110-
assertThat(getDataStreamResponse.getDataStreams().get(0).getDataStream().getName(), equalTo(dataStreamName));
111-
List<Index> backingIndices = getDataStreamResponse.getDataStreams().get(0).getDataStream().getIndices();
112-
assertThat(backingIndices.size(), equalTo(2));
113-
String backingIndex = backingIndices.get(0).getName();
114-
assertThat(backingIndex, backingIndexEqualTo(dataStreamName, 1));
115-
String writeIndex = backingIndices.get(1).getName();
116-
assertThat(writeIndex, backingIndexEqualTo(dataStreamName, 2));
117-
});
100+
List<String> backingIndices = waitForDataStreamBackingIndices(dataStreamName, 2);
101+
String firstGenerationIndex = backingIndices.get(0);
102+
assertThat(firstGenerationIndex, backingIndexEqualTo(dataStreamName, 1));
103+
String secondGenerationIndex = backingIndices.get(1);
104+
assertThat(secondGenerationIndex, backingIndexEqualTo(dataStreamName, 2));
118105

119106
{
120107
ExplainDataStreamLifecycleAction.Request explainIndicesRequest = new ExplainDataStreamLifecycleAction.Request(
121108
TEST_REQUEST_TIMEOUT,
122-
new String[] {
123-
DataStream.getDefaultBackingIndexName(dataStreamName, 1),
124-
DataStream.getDefaultBackingIndexName(dataStreamName, 2) }
109+
new String[] { firstGenerationIndex, secondGenerationIndex }
125110
);
126111
ExplainDataStreamLifecycleAction.Response response = client().execute(
127112
ExplainDataStreamLifecycleAction.INSTANCE,
@@ -140,18 +125,16 @@ public void testExplainLifecycle() throws Exception {
140125
assertThat(explainIndex.getError(), nullValue());
141126
}
142127

143-
if (explainIndex.getIndex().equals(DataStream.getDefaultBackingIndexName(dataStreamName, 1))) {
128+
if (explainIndex.getIndex().equals(firstGenerationIndex)) {
144129
// first generation index was rolled over
145-
assertThat(explainIndex.getIndex(), is(DataStream.getDefaultBackingIndexName(dataStreamName, 1)));
146130
assertThat(explainIndex.getRolloverDate(), notNullValue());
147131
assertThat(explainIndex.getTimeSinceRollover(System::currentTimeMillis), notNullValue());
148132
assertThat(explainIndex.getGenerationTime(System::currentTimeMillis), notNullValue());
149133
} else {
150134
// the write index has not been rolled over yet
151-
assertThat(explainIndex.getGenerationTime(System::currentTimeMillis), nullValue());
152-
assertThat(explainIndex.getIndex(), is(DataStream.getDefaultBackingIndexName(dataStreamName, 2)));
153135
assertThat(explainIndex.getRolloverDate(), nullValue());
154136
assertThat(explainIndex.getTimeSinceRollover(System::currentTimeMillis), nullValue());
137+
assertThat(explainIndex.getGenerationTime(System::currentTimeMillis), nullValue());
155138
}
156139
}
157140
}
@@ -160,9 +143,7 @@ public void testExplainLifecycle() throws Exception {
160143
// let's also explain with include_defaults=true
161144
ExplainDataStreamLifecycleAction.Request explainIndicesRequest = new ExplainDataStreamLifecycleAction.Request(
162145
TEST_REQUEST_TIMEOUT,
163-
new String[] {
164-
DataStream.getDefaultBackingIndexName(dataStreamName, 1),
165-
DataStream.getDefaultBackingIndexName(dataStreamName, 2) },
146+
new String[] { firstGenerationIndex, secondGenerationIndex },
166147
true
167148
);
168149
ExplainDataStreamLifecycleAction.Response response = client().execute(
@@ -195,18 +176,16 @@ public void testExplainLifecycle() throws Exception {
195176
assertThat(explainIndex.getLifecycle(), notNullValue());
196177
assertThat(explainIndex.getLifecycle().dataRetention(), nullValue());
197178

198-
if (explainIndex.getIndex().equals(DataStream.getDefaultBackingIndexName(dataStreamName, 1))) {
179+
if (explainIndex.getIndex().equals(firstGenerationIndex)) {
199180
// first generation index was rolled over
200-
assertThat(explainIndex.getIndex(), is(DataStream.getDefaultBackingIndexName(dataStreamName, 1)));
201181
assertThat(explainIndex.getRolloverDate(), notNullValue());
202182
assertThat(explainIndex.getTimeSinceRollover(System::currentTimeMillis), notNullValue());
203183
assertThat(explainIndex.getGenerationTime(System::currentTimeMillis), notNullValue());
204184
} else {
205185
// the write index has not been rolled over yet
206-
assertThat(explainIndex.getGenerationTime(System::currentTimeMillis), nullValue());
207-
assertThat(explainIndex.getIndex(), is(DataStream.getDefaultBackingIndexName(dataStreamName, 2)));
208186
assertThat(explainIndex.getRolloverDate(), nullValue());
209187
assertThat(explainIndex.getTimeSinceRollover(System::currentTimeMillis), nullValue());
188+
assertThat(explainIndex.getGenerationTime(System::currentTimeMillis), nullValue());
210189
}
211190
}
212191
}
@@ -228,28 +207,15 @@ public void testSystemExplainLifecycle() throws Exception {
228207

229208
indexDocs(dataStreamName, 1);
230209

231-
assertBusy(() -> {
232-
GetDataStreamAction.Request getDataStreamRequest = new GetDataStreamAction.Request(
233-
TEST_REQUEST_TIMEOUT,
234-
new String[] { dataStreamName }
235-
);
236-
GetDataStreamAction.Response getDataStreamResponse = client().execute(GetDataStreamAction.INSTANCE, getDataStreamRequest)
237-
.actionGet();
238-
assertThat(getDataStreamResponse.getDataStreams().size(), equalTo(1));
239-
assertThat(getDataStreamResponse.getDataStreams().get(0).getDataStream().getName(), equalTo(dataStreamName));
240-
List<Index> backingIndices = getDataStreamResponse.getDataStreams().get(0).getDataStream().getIndices();
241-
assertThat(backingIndices.size(), equalTo(2));
242-
String backingIndex = backingIndices.get(0).getName();
243-
assertThat(backingIndex, backingIndexEqualTo(dataStreamName, 1));
244-
String writeIndex = backingIndices.get(1).getName();
245-
assertThat(writeIndex, backingIndexEqualTo(dataStreamName, 2));
246-
});
210+
List<String> backingIndices = waitForDataStreamBackingIndices(dataStreamName, 2);
211+
String firstGenerationIndex = backingIndices.get(0);
212+
assertThat(firstGenerationIndex, backingIndexEqualTo(dataStreamName, 1));
213+
String secondGenerationIndex = backingIndices.get(1);
214+
assertThat(secondGenerationIndex, backingIndexEqualTo(dataStreamName, 2));
247215

248216
ExplainDataStreamLifecycleAction.Request explainIndicesRequest = new ExplainDataStreamLifecycleAction.Request(
249217
TEST_REQUEST_TIMEOUT,
250-
new String[] {
251-
DataStream.getDefaultBackingIndexName(dataStreamName, 1),
252-
DataStream.getDefaultBackingIndexName(dataStreamName, 2) }
218+
new String[] { firstGenerationIndex, secondGenerationIndex }
253219
);
254220
ExplainDataStreamLifecycleAction.Response response = client().execute(
255221
ExplainDataStreamLifecycleAction.INSTANCE,
@@ -289,33 +255,21 @@ public void testExplainLifecycleForIndicesWithErrors() throws Exception {
289255
indexDocs(dataStreamName, 1);
290256

291257
// let's allow one rollover to go through
292-
assertBusy(() -> {
293-
GetDataStreamAction.Request getDataStreamRequest = new GetDataStreamAction.Request(
294-
TEST_REQUEST_TIMEOUT,
295-
new String[] { dataStreamName }
296-
);
297-
GetDataStreamAction.Response getDataStreamResponse = client().execute(GetDataStreamAction.INSTANCE, getDataStreamRequest)
298-
.actionGet();
299-
assertThat(getDataStreamResponse.getDataStreams().size(), equalTo(1));
300-
assertThat(getDataStreamResponse.getDataStreams().get(0).getDataStream().getName(), equalTo(dataStreamName));
301-
List<Index> backingIndices = getDataStreamResponse.getDataStreams().get(0).getDataStream().getIndices();
302-
assertThat(backingIndices.size(), equalTo(2));
303-
String backingIndex = backingIndices.get(0).getName();
304-
assertThat(backingIndex, backingIndexEqualTo(dataStreamName, 1));
305-
String writeIndex = backingIndices.get(1).getName();
306-
assertThat(writeIndex, backingIndexEqualTo(dataStreamName, 2));
307-
});
258+
List<String> backingIndices = waitForDataStreamBackingIndices(dataStreamName, 2);
259+
String firstGenerationIndex = backingIndices.get(0);
260+
assertThat(firstGenerationIndex, backingIndexEqualTo(dataStreamName, 1));
261+
String secondGenerationIndex = backingIndices.get(1);
262+
assertThat(secondGenerationIndex, backingIndexEqualTo(dataStreamName, 2));
308263

309264
// prevent new indices from being created (ie. future rollovers)
310265
updateClusterSettings(Settings.builder().put(SETTING_CLUSTER_MAX_SHARDS_PER_NODE.getKey(), 1));
311266

312267
indexDocs(dataStreamName, 1);
313268

314-
String writeIndexName = DataStream.getDefaultBackingIndexName(dataStreamName, 2);
315269
assertBusy(() -> {
316270
ExplainDataStreamLifecycleAction.Request explainIndicesRequest = new ExplainDataStreamLifecycleAction.Request(
317271
TEST_REQUEST_TIMEOUT,
318-
new String[] { writeIndexName }
272+
new String[] { secondGenerationIndex }
319273
);
320274
ExplainDataStreamLifecycleAction.Response response = client().execute(
321275
ExplainDataStreamLifecycleAction.INSTANCE,
@@ -325,7 +279,7 @@ public void testExplainLifecycleForIndicesWithErrors() throws Exception {
325279
// we requested the explain for indices with the default include_details=false
326280
assertThat(response.getRolloverConfiguration(), nullValue());
327281
for (ExplainIndexDataStreamLifecycle explainIndex : response.getIndices()) {
328-
assertThat(explainIndex.getIndex(), is(writeIndexName));
282+
assertThat(explainIndex.getIndex(), is(secondGenerationIndex));
329283
assertThat(explainIndex.isManagedByLifecycle(), is(true));
330284
assertThat(explainIndex.getIndexCreationDate(), notNullValue());
331285
assertThat(explainIndex.getLifecycle(), notNullValue());
@@ -347,7 +301,7 @@ public void testExplainLifecycleForIndicesWithErrors() throws Exception {
347301
assertBusy(() -> {
348302
ExplainDataStreamLifecycleAction.Request explainIndicesRequest = new ExplainDataStreamLifecycleAction.Request(
349303
TEST_REQUEST_TIMEOUT,
350-
new String[] { writeIndexName }
304+
new String[] { secondGenerationIndex }
351305
);
352306
ExplainDataStreamLifecycleAction.Response response = client().execute(
353307
ExplainDataStreamLifecycleAction.INSTANCE,
@@ -385,11 +339,14 @@ public void testExplainDataStreamLifecycleForUnmanagedIndices() throws Exception
385339

386340
indexDocs(dataStreamName, 4);
387341

388-
String writeIndexName = DataStream.getDefaultBackingIndexName(dataStreamName, 1);
342+
List<String> backingIndices = waitForDataStreamBackingIndices(dataStreamName, 1);
343+
String firstGenerationIndex = backingIndices.get(0);
344+
assertThat(firstGenerationIndex, backingIndexEqualTo(dataStreamName, 1));
345+
389346
assertBusy(() -> {
390347
ExplainDataStreamLifecycleAction.Request explainIndicesRequest = new ExplainDataStreamLifecycleAction.Request(
391348
TEST_REQUEST_TIMEOUT,
392-
new String[] { writeIndexName }
349+
new String[] { firstGenerationIndex }
393350
);
394351
ExplainDataStreamLifecycleAction.Response response = client().execute(
395352
ExplainDataStreamLifecycleAction.INSTANCE,
@@ -399,7 +356,7 @@ public void testExplainDataStreamLifecycleForUnmanagedIndices() throws Exception
399356
assertThat(response.getRolloverConfiguration(), nullValue());
400357
for (ExplainIndexDataStreamLifecycle explainIndex : response.getIndices()) {
401358
assertThat(explainIndex.isManagedByLifecycle(), is(false));
402-
assertThat(explainIndex.getIndex(), is(writeIndexName));
359+
assertThat(explainIndex.getIndex(), is(firstGenerationIndex));
403360
assertThat(explainIndex.getIndexCreationDate(), nullValue());
404361
assertThat(explainIndex.getLifecycle(), nullValue());
405362
assertThat(explainIndex.getGenerationTime(System::currentTimeMillis), nullValue());

0 commit comments

Comments
 (0)