Skip to content

Commit 525e6b4

Browse files
Merge branch 'main' into unknown-query-parameter-error-message
2 parents c71d146 + ff3950d commit 525e6b4

File tree

41 files changed

+2288
-2251
lines changed

Some content is hidden

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

41 files changed

+2288
-2251
lines changed

branches.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
{
88
"branch": "8.16"
99
},
10+
{
11+
"branch": "9.0"
12+
},
13+
{
14+
"branch": "8.18"
15+
},
1016
{
1117
"branch": "8.17"
1218
},

docs/changelog/121193.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
pr: 121193
2+
summary: Enable LOOKUP JOIN in non-snapshot builds
3+
area: ES|QL
4+
type: enhancement
5+
issues:
6+
- 121185
7+
highlight:
8+
title: Enable LOOKUP JOIN in non-snapshot builds
9+
body: |-
10+
This effectively releases LOOKUP JOIN into tech preview. Docs will
11+
follow in a separate PR.
12+
13+
- Enable the lexing/grammar for LOOKUP JOIN in non-snapshot builds.
14+
- Remove the grammar for the unsupported `| JOIN ...` command (without `LOOKUP` as first keyword). The way the lexer modes work, otherwise we'd also have to enable `| JOIN ...` syntax on non-snapshot builds and would have to add additional validation to provide appropriate error messages.
15+
- Remove grammar for `LOOKUP JOIN index AS ...` because qualifiers are not yet supported. Otherwise we'd have to put in additional validation as well to prevent such queries.
16+
17+
Also fix https://github.com/elastic/elasticsearch/issues/121185
18+
notable: true

docs/reference/search/search-your-data/semantic-text-hybrid-search

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ POST _tasks/<task_id>/_cancel
113113
==== Perform hybrid search
114114

115115
After reindexing the data into the `semantic-embeddings` index, you can perform hybrid search by using <<rrf,reciprocal rank fusion (RRF)>>. RRF is a technique that merges the rankings from both semantic and lexical queries, giving more weight to results that rank high in either search. This ensures that the final results are balanced and relevant.
116+
To extract the most relevant fragments from the original text and query, you can use the <<highlighting,highlight parameter>>:
116117

117118
[source,console]
118119
------------------------------------------------------------
@@ -142,6 +143,13 @@ GET semantic-embeddings/_search
142143
}
143144
]
144145
}
146+
},
147+
"highlight": {
148+
"fields": {
149+
"semantic_text": {
150+
"number_of_fragments": 2 <5>
151+
}
152+
}
145153
}
146154
}
147155
------------------------------------------------------------
@@ -150,7 +158,7 @@ GET semantic-embeddings/_search
150158
<2> Lexical search is performed on the `content` field using the specified phrase.
151159
<3> The second `standard` retriever refers to the semantic search.
152160
<4> The `semantic_text` field is used to perform the semantic search.
153-
161+
<5> Specifies the maximum number of fragments to return. See <<semantic-text-highlighting, semantic text highlighting>> for a more complete example.
154162

155163
After performing the hybrid search, the query will return the top 10 documents that match both semantic and lexical search criteria. The results include detailed information about each document:
156164

@@ -178,36 +186,14 @@ After performing the hybrid search, the query will return the top 10 documents t
178186
"_score": 0.032786883,
179187
"_rank": 1,
180188
"_source": {
181-
"semantic_text": {
182-
"inference": {
183-
"inference_id": "my-elser-endpoint",
184-
"model_settings": {
185-
"task_type": "sparse_embedding"
186-
},
187-
"chunks": [
188-
{
189-
"text": "What so many out there do not realize is the importance of what you do after you work out. You may have done the majority of the work, but how you treat your body in the minutes and hours after you exercise has a direct effect on muscle soreness, muscle strength and growth, and staying hydrated. Cool Down. After your last exercise, your workout is not over. The first thing you need to do is cool down. Even if running was all that you did, you still should do light cardio for a few minutes. This brings your heart rate down at a slow and steady pace, which helps you avoid feeling sick after a workout.",
190-
"embeddings": {
191-
"exercise": 1.571044,
192-
"after": 1.3603843,
193-
"sick": 1.3281639,
194-
"cool": 1.3227621,
195-
"muscle": 1.2645415,
196-
"sore": 1.2561599,
197-
"cooling": 1.2335974,
198-
"running": 1.1750668,
199-
"hours": 1.1104802,
200-
"out": 1.0991782,
201-
"##io": 1.0794281,
202-
"last": 1.0474665,
203-
(...)
204-
}
205-
}
206-
]
207-
}
208-
},
209189
"id": 8408852,
210190
"content": "What so many out there do not realize is the importance of (...)"
191+
},
192+
"highlight" : {
193+
"semantic_text" : [
194+
"... fragment_1 ...",
195+
"... fragment_2 ..."
196+
]
211197
}
212198
}
213199
]

libs/entitlement/src/main/java/module-info.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
exports org.elasticsearch.entitlement.runtime.api;
2121
exports org.elasticsearch.entitlement.runtime.policy;
22+
exports org.elasticsearch.entitlement.runtime.policy.entitlements to org.elasticsearch.server;
2223
exports org.elasticsearch.entitlement.instrumentation;
2324
exports org.elasticsearch.entitlement.bootstrap to org.elasticsearch.server;
2425
exports org.elasticsearch.entitlement.initialization to java.base;

libs/entitlement/src/main/java/org/elasticsearch/entitlement/initialization/EntitlementInitialization.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
import org.elasticsearch.entitlement.instrumentation.MethodKey;
1919
import org.elasticsearch.entitlement.instrumentation.Transformer;
2020
import org.elasticsearch.entitlement.runtime.api.ElasticsearchEntitlementChecker;
21-
import org.elasticsearch.entitlement.runtime.policy.CreateClassLoaderEntitlement;
22-
import org.elasticsearch.entitlement.runtime.policy.Entitlement;
23-
import org.elasticsearch.entitlement.runtime.policy.ExitVMEntitlement;
24-
import org.elasticsearch.entitlement.runtime.policy.InboundNetworkEntitlement;
25-
import org.elasticsearch.entitlement.runtime.policy.LoadNativeLibrariesEntitlement;
26-
import org.elasticsearch.entitlement.runtime.policy.OutboundNetworkEntitlement;
2721
import org.elasticsearch.entitlement.runtime.policy.Policy;
2822
import org.elasticsearch.entitlement.runtime.policy.PolicyManager;
2923
import org.elasticsearch.entitlement.runtime.policy.Scope;
24+
import org.elasticsearch.entitlement.runtime.policy.entitlements.CreateClassLoaderEntitlement;
25+
import org.elasticsearch.entitlement.runtime.policy.entitlements.Entitlement;
26+
import org.elasticsearch.entitlement.runtime.policy.entitlements.ExitVMEntitlement;
27+
import org.elasticsearch.entitlement.runtime.policy.entitlements.InboundNetworkEntitlement;
28+
import org.elasticsearch.entitlement.runtime.policy.entitlements.LoadNativeLibrariesEntitlement;
29+
import org.elasticsearch.entitlement.runtime.policy.entitlements.OutboundNetworkEntitlement;
3030

3131
import java.lang.instrument.Instrumentation;
3232
import java.lang.reflect.Constructor;

libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/ExternalEntitlement.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
package org.elasticsearch.entitlement.runtime.policy;
1111

12+
import org.elasticsearch.entitlement.runtime.policy.entitlements.Entitlement;
13+
1214
import java.lang.annotation.ElementType;
1315
import java.lang.annotation.Retention;
1416
import java.lang.annotation.RetentionPolicy;

libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/FileAccessTree.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
package org.elasticsearch.entitlement.runtime.policy;
1111

1212
import org.elasticsearch.core.SuppressForbidden;
13+
import org.elasticsearch.entitlement.runtime.policy.entitlements.FileEntitlement;
1314

1415
import java.io.File;
1516
import java.nio.file.Path;
@@ -18,13 +19,13 @@
1819
import java.util.List;
1920
import java.util.Objects;
2021

21-
final class FileAccessTree {
22-
static final FileAccessTree EMPTY = new FileAccessTree(List.of());
22+
public final class FileAccessTree {
23+
public static final FileAccessTree EMPTY = new FileAccessTree(List.of());
2324

2425
private final String[] readPaths;
2526
private final String[] writePaths;
2627

27-
FileAccessTree(List<FileEntitlement> fileEntitlements) {
28+
private FileAccessTree(List<FileEntitlement> fileEntitlements) {
2829
List<String> readPaths = new ArrayList<>();
2930
List<String> writePaths = new ArrayList<>();
3031
for (FileEntitlement fileEntitlement : fileEntitlements) {
@@ -42,6 +43,10 @@ final class FileAccessTree {
4243
this.writePaths = writePaths.toArray(new String[0]);
4344
}
4445

46+
public static FileAccessTree of(List<FileEntitlement> fileEntitlements) {
47+
return new FileAccessTree(fileEntitlements);
48+
}
49+
4550
boolean canRead(Path path) {
4651
return checkPath(normalize(path), readPaths);
4752
}

libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyManager.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@
1313
import org.elasticsearch.core.SuppressForbidden;
1414
import org.elasticsearch.entitlement.instrumentation.InstrumentationService;
1515
import org.elasticsearch.entitlement.runtime.api.NotEntitledException;
16+
import org.elasticsearch.entitlement.runtime.policy.entitlements.CreateClassLoaderEntitlement;
17+
import org.elasticsearch.entitlement.runtime.policy.entitlements.Entitlement;
18+
import org.elasticsearch.entitlement.runtime.policy.entitlements.ExitVMEntitlement;
19+
import org.elasticsearch.entitlement.runtime.policy.entitlements.FileEntitlement;
20+
import org.elasticsearch.entitlement.runtime.policy.entitlements.InboundNetworkEntitlement;
21+
import org.elasticsearch.entitlement.runtime.policy.entitlements.LoadNativeLibrariesEntitlement;
22+
import org.elasticsearch.entitlement.runtime.policy.entitlements.OutboundNetworkEntitlement;
23+
import org.elasticsearch.entitlement.runtime.policy.entitlements.SetHttpsConnectionPropertiesEntitlement;
24+
import org.elasticsearch.entitlement.runtime.policy.entitlements.WriteSystemPropertiesEntitlement;
1625
import org.elasticsearch.logging.LogManager;
1726
import org.elasticsearch.logging.Logger;
1827

@@ -55,7 +64,7 @@ public static ModuleEntitlements from(List<Entitlement> entitlements) {
5564
.toList();
5665
return new ModuleEntitlements(
5766
entitlements.stream().collect(groupingBy(Entitlement::getClass)),
58-
new FileAccessTree(fileEntitlements)
67+
FileAccessTree.of(fileEntitlements)
5968
);
6069
}
6170

libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyParser.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99

1010
package org.elasticsearch.entitlement.runtime.policy;
1111

12+
import org.elasticsearch.entitlement.runtime.policy.entitlements.CreateClassLoaderEntitlement;
13+
import org.elasticsearch.entitlement.runtime.policy.entitlements.Entitlement;
14+
import org.elasticsearch.entitlement.runtime.policy.entitlements.FileEntitlement;
15+
import org.elasticsearch.entitlement.runtime.policy.entitlements.InboundNetworkEntitlement;
16+
import org.elasticsearch.entitlement.runtime.policy.entitlements.LoadNativeLibrariesEntitlement;
17+
import org.elasticsearch.entitlement.runtime.policy.entitlements.OutboundNetworkEntitlement;
18+
import org.elasticsearch.entitlement.runtime.policy.entitlements.SetHttpsConnectionPropertiesEntitlement;
19+
import org.elasticsearch.entitlement.runtime.policy.entitlements.WriteSystemPropertiesEntitlement;
1220
import org.elasticsearch.xcontent.XContentLocation;
1321
import org.elasticsearch.xcontent.XContentParser;
1422
import org.elasticsearch.xcontent.XContentParserConfiguration;

libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyValidationException.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
* parser is able to wrap this exception with a line/character number for
1616
* additional useful error information.
1717
*/
18-
class PolicyValidationException extends RuntimeException {
18+
public class PolicyValidationException extends RuntimeException {
1919

20-
PolicyValidationException(String message) {
20+
public PolicyValidationException(String message) {
2121
super(message);
2222
}
2323

24-
PolicyValidationException(String message, Throwable cause) {
24+
public PolicyValidationException(String message, Throwable cause) {
2525
super(message, cause);
2626
}
2727
}

0 commit comments

Comments
 (0)