Skip to content

Commit 918728a

Browse files
Merge remote-tracking branch 'elastic/main' into top-hits-via-cleaner
2 parents 622e5ad + c0771f8 commit 918728a

File tree

270 files changed

+4535
-4333
lines changed

Some content is hidden

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

270 files changed

+4535
-4333
lines changed

benchmarks/src/main/java/org/elasticsearch/benchmark/vector/VectorScorerBenchmark.java

+32-17
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,19 @@
88

99
package org.elasticsearch.benchmark.vector;
1010

11+
import org.apache.lucene.codecs.lucene99.OffHeapQuantizedByteVectorValues;
1112
import org.apache.lucene.index.VectorSimilarityFunction;
1213
import org.apache.lucene.store.Directory;
1314
import org.apache.lucene.store.IOContext;
1415
import org.apache.lucene.store.IndexInput;
1516
import org.apache.lucene.store.IndexOutput;
1617
import org.apache.lucene.store.MMapDirectory;
18+
import org.apache.lucene.util.hnsw.RandomVectorScorer;
19+
import org.apache.lucene.util.quantization.RandomAccessQuantizedByteVectorValues;
20+
import org.apache.lucene.util.quantization.ScalarQuantizedRandomVectorScorer;
1721
import org.apache.lucene.util.quantization.ScalarQuantizedVectorSimilarity;
1822
import org.elasticsearch.common.logging.LogConfigurator;
1923
import org.elasticsearch.core.IOUtils;
20-
import org.elasticsearch.vec.VectorScorer;
2124
import org.elasticsearch.vec.VectorScorerFactory;
2225
import org.openjdk.jmh.annotations.Benchmark;
2326
import org.openjdk.jmh.annotations.BenchmarkMode;
@@ -71,10 +74,10 @@ public class VectorScorerBenchmark {
7174
float vec2Offset;
7275
float scoreCorrectionConstant;
7376

74-
ScalarQuantizedVectorSimilarity luceneDotScorer;
75-
ScalarQuantizedVectorSimilarity luceneSqrScorer;
76-
VectorScorer nativeDotScorer;
77-
VectorScorer nativeSqrScorer;
77+
RandomVectorScorer luceneDotScorer;
78+
RandomVectorScorer luceneSqrScorer;
79+
RandomVectorScorer nativeDotScorer;
80+
RandomVectorScorer nativeSqrScorer;
7881

7982
@Setup
8083
public void setup() throws IOException {
@@ -107,14 +110,22 @@ public void setup() throws IOException {
107110
out.writeInt(Float.floatToIntBits(vec2Offset));
108111
}
109112
in = dir.openInput("vector.data", IOContext.DEFAULT);
113+
var values = vectorValues(dims, 2, in);
110114

111-
luceneDotScorer = ScalarQuantizedVectorSimilarity.fromVectorSimilarity(
112-
VectorSimilarityFunction.DOT_PRODUCT,
113-
scoreCorrectionConstant
115+
luceneDotScorer = new ScalarQuantizedRandomVectorScorer(
116+
ScalarQuantizedVectorSimilarity.fromVectorSimilarity(VectorSimilarityFunction.DOT_PRODUCT, scoreCorrectionConstant),
117+
values.copy(),
118+
vec1,
119+
vec1Offset
114120
);
115-
luceneSqrScorer = ScalarQuantizedVectorSimilarity.fromVectorSimilarity(VectorSimilarityFunction.EUCLIDEAN, scoreCorrectionConstant);
116-
nativeDotScorer = factory.getInt7ScalarQuantizedVectorScorer(dims, size, scoreCorrectionConstant, DOT_PRODUCT, in).get();
117-
nativeSqrScorer = factory.getInt7ScalarQuantizedVectorScorer(dims, size, scoreCorrectionConstant, EUCLIDEAN, in).get();
121+
luceneSqrScorer = new ScalarQuantizedRandomVectorScorer(
122+
ScalarQuantizedVectorSimilarity.fromVectorSimilarity(VectorSimilarityFunction.EUCLIDEAN, scoreCorrectionConstant),
123+
values.copy(),
124+
vec1,
125+
vec1Offset
126+
);
127+
nativeDotScorer = factory.getInt7ScalarQuantizedVectorScorer(DOT_PRODUCT, in, values, scoreCorrectionConstant).get().scorer(0);
128+
nativeSqrScorer = factory.getInt7ScalarQuantizedVectorScorer(EUCLIDEAN, in, values, scoreCorrectionConstant).get().scorer(0);
118129

119130
// sanity
120131
var f1 = dotProductLucene();
@@ -144,13 +155,13 @@ public void teardown() throws IOException {
144155
}
145156

146157
@Benchmark
147-
public float dotProductLucene() {
148-
return luceneDotScorer.score(vec1, vec1Offset, vec2, vec2Offset);
158+
public float dotProductLucene() throws IOException {
159+
return luceneDotScorer.score(1);
149160
}
150161

151162
@Benchmark
152163
public float dotProductNative() throws IOException {
153-
return nativeDotScorer.score(0, 1);
164+
return nativeDotScorer.score(1);
154165
}
155166

156167
@Benchmark
@@ -166,13 +177,13 @@ public float dotProductScalar() {
166177
// -- square distance
167178

168179
@Benchmark
169-
public float squareDistanceLucene() {
170-
return luceneSqrScorer.score(vec1, vec1Offset, vec2, vec2Offset);
180+
public float squareDistanceLucene() throws IOException {
181+
return luceneSqrScorer.score(1);
171182
}
172183

173184
@Benchmark
174185
public float squareDistanceNative() throws IOException {
175-
return nativeSqrScorer.score(0, 1);
186+
return nativeSqrScorer.score(1);
176187
}
177188

178189
@Benchmark
@@ -186,6 +197,10 @@ public float squareDistanceScalar() {
186197
return 1 / (1f + adjustedDistance);
187198
}
188199

200+
RandomAccessQuantizedByteVectorValues vectorValues(int dims, int size, IndexInput in) throws IOException {
201+
return new OffHeapQuantizedByteVectorValues.DenseOffHeapVectorValues(dims, size, in.slice("values", 0, in.length()));
202+
}
203+
189204
// Unsigned int7 byte vectors have values in the range of 0 to 127 (inclusive).
190205
static final byte MIN_INT7_VALUE = 0;
191206
static final byte MAX_INT7_VALUE = 127;

docs/changelog/108746.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 108746
2+
summary: Support synthetic source for `aggregate_metric_double` when ignore_malf…
3+
area: Mapping
4+
type: feature
5+
issues: []

docs/changelog/108878.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 108878
2+
summary: Support arrays in fallback synthetic source implementation
3+
area: Mapping
4+
type: feature
5+
issues: []

docs/changelog/108881.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 108881
2+
summary: Add synthetic source support for `geo_shape` via fallback implementation
3+
area: Mapping
4+
type: feature
5+
issues: []

docs/changelog/108931.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 108931
2+
summary: Guard systemd library lookup from unreadable directories
3+
area: Infra/Core
4+
type: bug
5+
issues: []

docs/changelog/108942.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 108942
2+
summary: Fix NPE in trained model assignment updater
3+
area: Machine Learning
4+
type: bug
5+
issues: []

docs/changelog/108999.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 108999
2+
summary: Use default translog durability on AD results index
3+
area: Machine Learning
4+
type: bug
5+
issues: []

docs/changelog/109020.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 109020
2+
summary: Only skip deleting a downsampled index if downsampling is in progress as
3+
part of DSL retention
4+
area: Data streams
5+
type: bug
6+
issues: []

docs/reference/esql/esql-async-query-api.asciidoc

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ POST /_query/async
2424
| SORT year
2525
| LIMIT 5
2626
""",
27-
"wait_for_completion_timeout": "2s",
28-
"version": "2024.04.01"
27+
"wait_for_completion_timeout": "2s"
2928
}
3029
----
3130
// TEST[setup:library]

docs/reference/esql/esql-query-api.asciidoc

+1-6
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ POST /_query
1616
| STATS MAX(page_count) BY year
1717
| SORT year
1818
| LIMIT 5
19-
""",
20-
"version": "2024.04.01"
19+
"""
2120
}
2221
----
2322
// TEST[setup:library]
@@ -79,10 +78,6 @@ For syntax, refer to <<esql-locale-param>>.
7978
`query`::
8079
(Required, string) {esql} query to run. For syntax, refer to <<esql-syntax>>.
8180

82-
`version`::
83-
(Required, string) {esql} language version. Can be sent in short or long form, e.g.
84-
`2024.04.01` or `2024.04.01.🚀`. See <<esql-version>> for details.
85-
8681
[discrete]
8782
[role="child_attributes"]
8883
[[esql-query-api-response-body]]

docs/reference/esql/esql-rest.asciidoc

+8-16
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ The <<esql-query-api,{esql} query API>> accepts an {esql} query string in the
1616
----
1717
POST /_query?format=txt
1818
{
19-
"query": "FROM library | KEEP author, name, page_count, release_date | SORT page_count DESC | LIMIT 5",
20-
"version": "2024.04.01"
19+
"query": "FROM library | KEEP author, name, page_count, release_date | SORT page_count DESC | LIMIT 5"
2120
}
2221
----
2322
// TEST[setup:library]
@@ -56,8 +55,7 @@ POST /_query?format=txt
5655
| KEEP author, name, page_count, release_date
5756
| SORT page_count DESC
5857
| LIMIT 5
59-
""",
60-
"version": "2024.04.01"
58+
"""
6159
}
6260
----
6361
// TEST[setup:library]
@@ -145,8 +143,7 @@ POST /_query?format=txt
145143
"lte": 200
146144
}
147145
}
148-
},
149-
"version": "2024.04.01"
146+
}
150147
}
151148
----
152149
// TEST[setup:library]
@@ -182,8 +179,7 @@ POST /_query?format=json
182179
| SORT page_count DESC
183180
| LIMIT 5
184181
""",
185-
"columnar": true,
186-
"version": "2024.04.01"
182+
"columnar": true
187183
}
188184
----
189185
// TEST[setup:library]
@@ -230,8 +226,7 @@ POST /_query
230226
| EVAL birth_date = date_parse(birth_date_string)
231227
| EVAL month_of_birth = DATE_FORMAT("MMMM",birth_date)
232228
| LIMIT 5
233-
""",
234-
"version": "2024.04.01"
229+
"""
235230
}
236231
----
237232
// TEST[setup:library]
@@ -254,8 +249,7 @@ POST /_query
254249
| STATS count = COUNT(*) by year
255250
| WHERE count > 0
256251
| LIMIT 5
257-
""",
258-
"version": "2024.04.01"
252+
"""
259253
}
260254
----
261255
// TEST[setup:library]
@@ -276,8 +270,7 @@ POST /_query
276270
| WHERE count > ?
277271
| LIMIT 5
278272
""",
279-
"params": [300, "Frank Herbert", 0],
280-
"version": "2024.04.01"
273+
"params": [300, "Frank Herbert", 0]
281274
}
282275
----
283276
// TEST[setup:library]
@@ -311,8 +304,7 @@ POST /_query/async
311304
| SORT year
312305
| LIMIT 5
313306
""",
314-
"wait_for_completion_timeout": "2s",
315-
"version": "2024.04.01"
307+
"wait_for_completion_timeout": "2s"
316308
}
317309
----
318310
// TEST[setup:library]

docs/reference/esql/esql-using.asciidoc

-4
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,8 @@ Using {esql} to query across multiple clusters.
1818
<<esql-task-management>>::
1919
Using the <<tasks,task management API>> to list and cancel {esql} queries.
2020

21-
<<esql-version>>::
22-
Information about {esql} language versions.
23-
2421
include::esql-rest.asciidoc[]
2522
include::esql-kibana.asciidoc[]
2623
include::esql-security-solution.asciidoc[]
2724
include::esql-across-clusters.asciidoc[]
2825
include::task-management.asciidoc[]
29-
include::esql-version.asciidoc[]

docs/reference/esql/esql-version.asciidoc

-49
This file was deleted.

docs/reference/esql/multivalued-fields.asciidoc

+7-13
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ POST /mv/_bulk?refresh
1717
1818
POST /_query
1919
{
20-
"query": "FROM mv | LIMIT 2",
21-
"version": "2024.04.01"
20+
"query": "FROM mv | LIMIT 2"
2221
}
2322
----
2423

@@ -66,8 +65,7 @@ POST /mv/_bulk?refresh
6665
6766
POST /_query
6867
{
69-
"query": "FROM mv | LIMIT 2",
70-
"version": "2024.04.01"
68+
"query": "FROM mv | LIMIT 2"
7169
}
7270
----
7371

@@ -108,8 +106,7 @@ POST /mv/_bulk?refresh
108106
109107
POST /_query
110108
{
111-
"query": "FROM mv | LIMIT 2",
112-
"version": "2024.04.01"
109+
"query": "FROM mv | LIMIT 2"
113110
}
114111
----
115112

@@ -151,8 +148,7 @@ POST /mv/_bulk?refresh
151148
152149
POST /_query
153150
{
154-
"query": "FROM mv | EVAL b=TO_STRING(b) | LIMIT 2",
155-
"version": "2024.04.01"
151+
"query": "FROM mv | EVAL b=TO_STRING(b) | LIMIT 2"
156152
}
157153
----
158154

@@ -175,7 +171,7 @@ POST /_query
175171
==== Functions
176172

177173
Unless otherwise documented functions will return `null` when applied to a multivalued
178-
field. This behavior may change in a later version.
174+
field.
179175

180176
[source,console,id=esql-multivalued-fields-mv-into-null]
181177
----
@@ -190,8 +186,7 @@ POST /mv/_bulk?refresh
190186
----
191187
POST /_query
192188
{
193-
"query": "FROM mv | EVAL b + 2, a + b | LIMIT 4",
194-
"version": "2024.04.01"
189+
"query": "FROM mv | EVAL b + 2, a + b | LIMIT 4"
195190
}
196191
----
197192
// TEST[continued]
@@ -230,8 +225,7 @@ Work around this limitation by converting the field to single value with one of:
230225
----
231226
POST /_query
232227
{
233-
"query": "FROM mv | EVAL b=MV_MIN(b) | EVAL b + 2, a + b | LIMIT 4",
234-
"version": "2024.04.01"
228+
"query": "FROM mv | EVAL b=MV_MIN(b) | EVAL b + 2, a + b | LIMIT 4"
235229
}
236230
----
237231
// TEST[continued]

0 commit comments

Comments
 (0)