Skip to content

Commit ddac429

Browse files
authored
Merge branch 'main' into fix/128221
2 parents e2b07b2 + 7b7d3f7 commit ddac429

File tree

62 files changed

+2852
-2102
lines changed

Some content is hidden

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

62 files changed

+2852
-2102
lines changed

build-tools/src/main/java/org/elasticsearch/gradle/test/TestBuildInfoPlugin.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,9 @@ public void apply(Project project) {
5757
task.into("META-INF", copy -> copy.from(testBuildInfoTask));
5858
});
5959

60-
if (project.getRootProject().getName().equals("elasticsearch")) {
61-
project.getTasks()
62-
.withType(Test.class)
63-
.matching(test -> List.of("test", "internalClusterTest").contains(test.getName()))
64-
.configureEach(test -> {
65-
test.systemProperty("es.entitlement.enableForTests", "true");
66-
});
67-
}
60+
project.getTasks()
61+
.withType(Test.class)
62+
.matching(test -> List.of("test", "internalClusterTest").contains(test.getName()))
63+
.configureEach(test -> test.getSystemProperties().putIfAbsent("es.entitlement.enableForTests", "true"));
6864
}
6965
}

docs/changelog/113949.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pr: 113949
2+
summary: Support kNN filter on nested metadata
3+
area: Vector Search
4+
type: enhancement
5+
issues:
6+
- 128803
7+
- 106994

docs/reference/query-languages/esql/_snippets/commands/layout/completion.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,26 @@ The `COMPLETION` command allows you to send prompts and context to a Large Langu
99

1010
**Syntax**
1111

12+
::::{tab-set}
13+
14+
:::{tab-item} 9.2.0+
15+
1216
```esql
13-
COMPLETION [column =] prompt WITH inference_id
17+
COMPLETION [column =] prompt WITH { "inference_id" : "my_inference_endpoint" }
1418
```
1519

20+
:::
21+
22+
:::{tab-item} 9.1.x only
23+
24+
```esql
25+
COMPLETION [column =] prompt WITH my_inference_endpoint
26+
```
27+
28+
:::
29+
30+
::::
31+
1632
**Parameters**
1733

1834
`column`
@@ -24,7 +40,7 @@ COMPLETION [column =] prompt WITH inference_id
2440
: The input text or expression used to prompt the LLM.
2541
This can be a string literal or a reference to a column containing text.
2642

27-
`inference_id`
43+
`my_inference_endpoint`
2844
: The ID of the [inference endpoint](docs-content://explore-analyze/elastic-inference/inference-api.md) to use for the task.
2945
The inference endpoint must be configured with the `completion` task type.
3046

@@ -75,7 +91,7 @@ How you increase the timeout depends on your deployment type:
7591
If you don't want to increase the timeout limit, try the following:
7692

7793
* Reduce data volume with `LIMIT` or more selective filters before the `COMPLETION` command
78-
* Split complex operations into multiple simpler queries
94+
* Split complex operations into multiple simpler queries
7995
* Configure your HTTP client's response timeout (Refer to [HTTP client configuration](/reference/elasticsearch/configuration-reference/networking-settings.md#_http_client_configuration))
8096

8197

@@ -85,7 +101,7 @@ Use the default column name (results stored in `completion` column):
85101

86102
```esql
87103
ROW question = "What is Elasticsearch?"
88-
| COMPLETION question WITH test_completion_model
104+
| COMPLETION question WITH { "inference_id" : "my_inference_endpoint" }
89105
| KEEP question, completion
90106
```
91107

@@ -97,7 +113,7 @@ Specify the output column (results stored in `answer` column):
97113

98114
```esql
99115
ROW question = "What is Elasticsearch?"
100-
| COMPLETION answer = question WITH test_completion_model
116+
| COMPLETION answer = question WITH { "inference_id" : "my_inference_endpoint" }
101117
| KEEP question, answer
102118
```
103119

@@ -117,7 +133,7 @@ FROM movies
117133
"Synopsis: ", synopsis, "\n",
118134
"Actors: ", MV_CONCAT(actors, ", "), "\n",
119135
)
120-
| COMPLETION summary = prompt WITH test_completion_model
136+
| COMPLETION summary = prompt WITH { "inference_id" : "my_inference_endpoint" }
121137
| KEEP title, summary, rating
122138
```
123139

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

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,19 @@ POST my-image-index/_search
203203
`knn` query can be used inside a nested query. The behaviour here is similar to [top level nested kNN search](docs-content://solutions/search/vector/knn.md#nested-knn-search):
204204

205205
* kNN search over nested dense_vectors diversifies the top results over the top-level document
206-
* `filter` over the top-level document metadata is supported and acts as a pre-filter
207-
* `filter` over `nested` field metadata is not supported
206+
* `filter` both over the top-level document metadata and `nested` is supported and acts as a pre-filter
207+
208+
::::{note}
209+
To ensure correct results: each individual filter must be either over
210+
the top-level metadata or `nested` metadata. However, a single knn query
211+
supports multiple filters, where some filters can be over the top-level
212+
metadata and some over nested.
213+
::::
208214

209-
A sample query can look like below:
215+
216+
Below is a sample query with filter over nested metadata.
217+
For scoring parents' documents, this query only considers vectors that
218+
have "paragraph.language" set to "EN".
210219

211220
```json
212221
{
@@ -215,12 +224,46 @@ A sample query can look like below:
215224
"path" : "paragraph",
216225
"query" : {
217226
"knn": {
218-
"query_vector": [
219-
0.45,
220-
45
221-
],
227+
"query_vector": [0.45, 0.50],
222228
"field": "paragraph.vector",
223-
"num_candidates": 2
229+
"filter": {
230+
"match": {
231+
"paragraph.language": "EN"
232+
}
233+
}
234+
}
235+
}
236+
}
237+
}
238+
}
239+
```
240+
241+
Below is a sample query with two filters: one over nested metadata
242+
and another over the top level metadata. For scoring parents' documents,
243+
this query only considers vectors whose parent's title contain "essay"
244+
word and have "paragraph.language" set to "EN".
245+
246+
```json
247+
{
248+
"query" : {
249+
"nested" : {
250+
"path" : "paragraph",
251+
"query" : {
252+
"knn": {
253+
"query_vector": [0.45, 0.50],
254+
"field": "paragraph.vector",
255+
"filter": [
256+
{
257+
"match": {
258+
"paragraph.language": "EN"
259+
}
260+
},
261+
{
262+
"match": {
263+
"title": "essay"
264+
}
265+
}
266+
]
224267
}
225268
}
226269
}

muted-tests.yml

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -407,9 +407,6 @@ tests:
407407
- class: org.elasticsearch.xpack.esql.analysis.VerifierTests
408408
method: testMatchInsideEval
409409
issue: https://github.com/elastic/elasticsearch/issues/131336
410-
- class: org.elasticsearch.packaging.test.DockerTests
411-
method: test022InstallPluginsFromLocalArchive
412-
issue: https://github.com/elastic/elasticsearch/issues/116866
413410
- class: org.elasticsearch.packaging.test.DockerTests
414411
method: test071BindMountCustomPathWithDifferentUID
415412
issue: https://github.com/elastic/elasticsearch/issues/120917
@@ -479,21 +476,9 @@ tests:
479476
- class: org.elasticsearch.compute.lucene.read.SortedSetOrdinalsBuilderTests
480477
method: testReader
481478
issue: https://github.com/elastic/elasticsearch/issues/131573
482-
- class: org.elasticsearch.search.SearchWithIndexBlocksIT
483-
method: testSearchShardsOnIndicesWithIndexRefreshBlocks
484-
issue: https://github.com/elastic/elasticsearch/issues/131662
485-
- class: org.elasticsearch.search.SearchWithIndexBlocksIT
486-
method: testSearchIndicesWithIndexRefreshBlocks
487-
issue: https://github.com/elastic/elasticsearch/issues/131693
488-
- class: org.elasticsearch.search.SearchWithIndexBlocksIT
489-
method: testOpenPITOnIndicesWithIndexRefreshBlocks
490-
issue: https://github.com/elastic/elasticsearch/issues/131695
491479
- class: org.elasticsearch.xpack.esql.ccq.MultiClustersIT
492480
method: testLookupJoinAliasesSkipOld
493481
issue: https://github.com/elastic/elasticsearch/issues/131697
494-
- class: org.elasticsearch.search.SearchWithIndexBlocksIT
495-
method: testMultiSearchIndicesWithIndexRefreshBlocks
496-
issue: https://github.com/elastic/elasticsearch/issues/131698
497482
- class: org.elasticsearch.indices.cluster.RemoteSearchForceConnectTimeoutIT
498483
method: testTimeoutSetting
499484
issue: https://github.com/elastic/elasticsearch/issues/131656
@@ -515,9 +500,6 @@ tests:
515500
- class: org.elasticsearch.test.rest.yaml.RcsCcsCommonYamlTestSuiteIT
516501
method: test {p0=search/600_flattened_ignore_above/flattened ignore_above multi-value field}
517502
issue: https://github.com/elastic/elasticsearch/issues/131967
518-
- class: org.elasticsearch.search.routing.SearchReplicaSelectionIT
519-
method: testNodeSelection
520-
issue: https://github.com/elastic/elasticsearch/issues/132017
521503
- class: org.elasticsearch.xpack.remotecluster.CrossClusterEsqlRCS1EnrichUnavailableRemotesIT
522504
method: testEsqlEnrichWithSkipUnavailable
523505
issue: https://github.com/elastic/elasticsearch/issues/132078
@@ -620,6 +602,19 @@ tests:
620602
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
621603
method: testDenseVectorMappingUpdate {initialType=int4_hnsw updateType=bbq_disk}
622604
issue: https://github.com/elastic/elasticsearch/issues/132165
605+
- class: org.elasticsearch.indices.cluster.FieldCapsForceConnectTimeoutIT
606+
method: testTimeoutSetting
607+
issue: https://github.com/elastic/elasticsearch/issues/132179
608+
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
609+
method: "testDenseVectorMappingUpdate {initialType=bbq_flat updateType=bbq_disk #2}"
610+
issue: https://github.com/elastic/elasticsearch/issues/132184
611+
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
612+
method: testDenseVectorMappingUpdate {initialType=bbq_hnsw updateType=bbq_disk}
613+
issue: https://github.com/elastic/elasticsearch/issues/132188
614+
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexTypeUpdateIT
615+
method: "testDenseVectorMappingUpdate {initialType=int8_flat updateType=bbq_disk #2}"
616+
issue: https://github.com/elastic/elasticsearch/issues/132189
617+
623618

624619
# Examples:
625620
#

plugins/examples/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ subprojects {
2020
targetCompatibility = 21
2121
}
2222

23+
test {
24+
// testing with entitlements doesn't work for example plugins ES-12453
25+
systemProperty 'es.entitlement.enableForTests', 'false'
26+
}
27+
2328
repositories {
2429
// Only necessary when building plugins against SNAPSHOT versions of Elasticsearch
2530
if (gradle.includedBuilds.isEmpty()) {

qa/multi-data-path/build.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apply plugin: 'elasticsearch.internal-yaml-rest-test'
2+
3+
// This subproject verifies MDP continues to work with entitlements.
4+
5+
restResources {
6+
restApi {
7+
include '_common', 'capabilities', 'index', 'indices', 'indices.create'
8+
}
9+
}
10+
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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.test.rest.yaml;
11+
12+
import com.carrotsearch.randomizedtesting.annotations.Name;
13+
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
14+
15+
import org.elasticsearch.test.cluster.ElasticsearchCluster;
16+
import org.junit.ClassRule;
17+
18+
import java.io.IOException;
19+
import java.nio.file.Files;
20+
21+
public class MDPYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
22+
23+
@ClassRule
24+
public static ElasticsearchCluster cluster = ElasticsearchCluster.local().setting("path.shared_data", tempSharedDataPath()).build();
25+
26+
public MDPYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
27+
super(testCandidate);
28+
}
29+
30+
@ParametersFactory
31+
public static Iterable<Object[]> parameters() throws Exception {
32+
return createParameters();
33+
}
34+
35+
@Override
36+
protected String getTestRestCluster() {
37+
return cluster.getHttpAddresses();
38+
}
39+
40+
private static String tempSharedDataPath() {
41+
try {
42+
return Files.createTempDirectory("shared_data").toString();
43+
} catch (IOException e) {
44+
throw new AssertionError(e);
45+
}
46+
}
47+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
"Index using shared data path":
3+
4+
- requires:
5+
test_runner_features: ["warnings"]
6+
7+
- do:
8+
warnings:
9+
- "[index.data_path] setting was deprecated in Elasticsearch and will be removed in a future release. See the deprecation documentation for the next major version."
10+
indices.create:
11+
index: test_index
12+
body:
13+
settings:
14+
data_path: "test_index_data_path"
15+
16+
- do:
17+
index:
18+
index: test_index
19+
id: "1"
20+
body: { foo: bar }
21+
22+
- match: { result: created }
23+
24+
- do:
25+
index:
26+
index: test_index
27+
id: "1"
28+
body: { foo: bar }
29+
op_type: index
30+
31+
- match: { result: updated }

qa/packaging/src/test/java/org/elasticsearch/packaging/test/DockerTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public void test022InstallPluginsFromLocalArchive() {
205205

206206
listPluginArchive().forEach(System.out::println);
207207
assertThat("Expected " + plugin + " to not be installed", listPlugins(), not(hasItems(plugin)));
208-
assertThat("Expected " + plugin + " available in archive", listPluginArchive(), hasSize(16));
208+
assertThat("Expected " + plugin + " available in archive", listPluginArchive(), hasItems(containsString(plugin)));
209209

210210
// Stuff the proxy settings with garbage, so any attempt to go out to the internet would fail
211211
sh.getEnv()

0 commit comments

Comments
 (0)