Skip to content

Commit ba65346

Browse files
committed
Merge remote-tracking branch 'origin/synthetic_vectors' into synthetic_vectors
2 parents 62c98c3 + 883af2c commit ba65346

File tree

38 files changed

+475
-191
lines changed

38 files changed

+475
-191
lines changed

docs/changelog/127223.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 127223
2+
summary: Wrap ES KNN queries with PatienceKNN query
3+
area: Vector Search
4+
type: feature
5+
issues: []

docs/changelog/130344.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 130344
2+
summary: "Fix queries with missing index, `skip_unavailable` and filters"
3+
area: ES|QL
4+
type: bug
5+
issues: []

docs/changelog/130382.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 130382
2+
summary: Remove vectors from `_source` transparently
3+
area: "Mapping, Vector Search"
4+
type: enhancement
5+
issues: []

docs/reference/elasticsearch/index-settings/index-modules.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,3 +259,6 @@ $$$index-esql-stored-fields-sequential-proportion$$$
259259

260260
`index.esql.stored_fields_sequential_proportion`
261261
: Tuning parameter for deciding when {{esql}} will load [Stored fields](/reference/elasticsearch/rest-apis/retrieve-selected-fields.md#stored-fields) using a strategy tuned for loading dense sequence of documents. Allows values between 0.0 and 1.0 and defaults to 0.2. Indices with documents smaller than 10kb may see speed improvements loading `text` fields by setting this lower.
262+
263+
$$$index-dense-vector-hnsw-early-termination$$$ `index.dense_vector.hnsw_early_termination`
264+
: Whether to apply _patience_ based early termination strategy to knn queries over HNSW graphs (see [paper](https://cs.uwaterloo.ca/~jimmylin/publications/Teofili_Lin_ECIR2025.pdf)). This is only applicable to `dense_vector` fields with `hnsw`, `int8_hnsw`, `int4_hnsw` and `bbq_hnsw` index types. Defaults to `false`.
Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
* [`AVG`](../../functions-operators/aggregation-functions.md#esql-avg)
2-
* [unavailable] [`AVG_OVER_TIME`](../../functions-operators/aggregation-functions.md#esql-avg_over_time)
32
* [`COUNT`](../../functions-operators/aggregation-functions.md#esql-count)
43
* [`COUNT_DISTINCT`](../../functions-operators/aggregation-functions.md#esql-count_distinct)
54
* [`MAX`](../../functions-operators/aggregation-functions.md#esql-max)
6-
* [unavailable] [`MAX_OVER_TIME`](../../functions-operators/aggregation-functions.md#esql-max_over_time)
75
* [`MEDIAN`](../../functions-operators/aggregation-functions.md#esql-median)
86
* [`MEDIAN_ABSOLUTE_DEVIATION`](../../functions-operators/aggregation-functions.md#esql-median_absolute_deviation)
97
* [`MIN`](../../functions-operators/aggregation-functions.md#esql-min)
10-
* [unavailable] [`MIN_OVER_TIME`](../../functions-operators/aggregation-functions.md#esql-min_over_time)
118
* [`PERCENTILE`](../../functions-operators/aggregation-functions.md#esql-percentile)
129
* [preview] [`ST_CENTROID_AGG`](../../functions-operators/aggregation-functions.md#esql-st_centroid_agg)
1310
* [preview] [`ST_EXTENT_AGG`](../../functions-operators/aggregation-functions.md#esql-st_extent_agg)
@@ -16,6 +13,3 @@
1613
* [`TOP`](../../functions-operators/aggregation-functions.md#esql-top)
1714
* [preview] [`VALUES`](../../functions-operators/aggregation-functions.md#esql-values)
1815
* [`WEIGHTED_AVG`](../../functions-operators/aggregation-functions.md#esql-weighted_avg)
19-
* [unavailable] [`FIRST_OVER_TIME`](../../functions-operators/aggregation-functions.md#esql-first_over_time)
20-
* [unavailable] [`LAST_OVER_TIME`](../../functions-operators/aggregation-functions.md#esql-last_over_time)
21-
* [unavailable] [`RATE`](../../functions-operators/aggregation-functions.md#esql-rate)
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
* [`FROM`](../../commands/source-commands.md#esql-from)
2-
* [`TS`](../../commands/source-commands.md#esql-ts)
32
* [`ROW`](../../commands/source-commands.md#esql-row)
43
* [`SHOW`](../../commands/source-commands.md#esql-show)

docs/reference/query-languages/esql/commands/source-commands.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ An {{esql}} source command produces a table, typically with data from {{es}}. An
2020
:::{include} ../_snippets/commands/layout/from.md
2121
:::
2222

23-
:::{include} ../_snippets/commands/layout/ts.md
24-
:::
25-
2623
:::{include} ../_snippets/commands/layout/row.md
2724
:::
2825

docs/reference/query-languages/esql/functions-operators/aggregation-functions.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ The [`STATS`](/reference/query-languages/esql/commands/processing-commands.md#es
1515
:::{include} ../_snippets/functions/layout/avg.md
1616
:::
1717

18-
:::{include} ../_snippets/functions/layout/avg_over_time.md
19-
:::
20-
2118
:::{include} ../_snippets/functions/layout/count.md
2219
:::
2320

@@ -27,9 +24,6 @@ The [`STATS`](/reference/query-languages/esql/commands/processing-commands.md#es
2724
:::{include} ../_snippets/functions/layout/max.md
2825
:::
2926

30-
:::{include} ../_snippets/functions/layout/max_over_time.md
31-
:::
32-
3327
:::{include} ../_snippets/functions/layout/median.md
3428
:::
3529

@@ -39,9 +33,6 @@ The [`STATS`](/reference/query-languages/esql/commands/processing-commands.md#es
3933
:::{include} ../_snippets/functions/layout/min.md
4034
:::
4135

42-
:::{include} ../_snippets/functions/layout/min_over_time.md
43-
:::
44-
4536
:::{include} ../_snippets/functions/layout/percentile.md
4637
:::
4738

@@ -65,12 +56,3 @@ The [`STATS`](/reference/query-languages/esql/commands/processing-commands.md#es
6556

6657
:::{include} ../_snippets/functions/layout/weighted_avg.md
6758
:::
68-
69-
:::{include} ../_snippets/functions/layout/first_over_time.md
70-
:::
71-
72-
:::{include} ../_snippets/functions/layout/last_over_time.md
73-
:::
74-
75-
:::{include} ../_snippets/functions/layout/rate.md
76-
:::

qa/vector/src/main/java/org/elasticsearch/test/knn/CmdLineArgs.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ record CmdLineArgs(
4848
VectorSimilarityFunction vectorSpace,
4949
int quantizeBits,
5050
VectorEncoding vectorEncoding,
51-
int dimensions
51+
int dimensions,
52+
boolean earlyTermination
5253
) implements ToXContentObject {
5354

5455
static final ParseField DOC_VECTORS_FIELD = new ParseField("doc_vectors");
@@ -71,6 +72,7 @@ record CmdLineArgs(
7172
static final ParseField QUANTIZE_BITS_FIELD = new ParseField("quantize_bits");
7273
static final ParseField VECTOR_ENCODING_FIELD = new ParseField("vector_encoding");
7374
static final ParseField DIMENSIONS_FIELD = new ParseField("dimensions");
75+
static final ParseField EARLY_TERMINATION_FIELD = new ParseField("early_termination");
7476

7577
static CmdLineArgs fromXContent(XContentParser parser) throws IOException {
7678
Builder builder = PARSER.apply(parser, null);
@@ -100,6 +102,7 @@ static CmdLineArgs fromXContent(XContentParser parser) throws IOException {
100102
PARSER.declareInt(Builder::setQuantizeBits, QUANTIZE_BITS_FIELD);
101103
PARSER.declareString(Builder::setVectorEncoding, VECTOR_ENCODING_FIELD);
102104
PARSER.declareInt(Builder::setDimensions, DIMENSIONS_FIELD);
105+
PARSER.declareBoolean(Builder::setEarlyTermination, EARLY_TERMINATION_FIELD);
103106
}
104107

105108
@Override
@@ -158,6 +161,7 @@ static class Builder {
158161
private int quantizeBits = 8;
159162
private VectorEncoding vectorEncoding = VectorEncoding.FLOAT32;
160163
private int dimensions;
164+
private boolean earlyTermination;
161165

162166
public Builder setDocVectors(String docVectors) {
163167
this.docVectors = PathUtils.get(docVectors);
@@ -259,6 +263,11 @@ public Builder setDimensions(int dimensions) {
259263
return this;
260264
}
261265

266+
public Builder setEarlyTermination(Boolean patience) {
267+
this.earlyTermination = patience;
268+
return this;
269+
}
270+
262271
public CmdLineArgs build() {
263272
if (docVectors == null) {
264273
throw new IllegalArgumentException("Document vectors path must be provided");
@@ -288,7 +297,8 @@ public CmdLineArgs build() {
288297
vectorSpace,
289298
quantizeBits,
290299
vectorEncoding,
291-
dimensions
300+
dimensions,
301+
earlyTermination
292302
);
293303
}
294304
}

qa/vector/src/main/java/org/elasticsearch/test/knn/KnnIndexTester.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public static void main(String[] args) throws Exception {
211211
for (int i = 0; i < results.length; i++) {
212212
int nProbe = nProbes[i];
213213
KnnSearcher knnSearcher = new KnnSearcher(indexPath, cmdLineArgs, nProbe);
214-
knnSearcher.runSearch(results[i]);
214+
knnSearcher.runSearch(results[i], cmdLineArgs.earlyTermination());
215215
}
216216
}
217217
formattedResults.results.addAll(List.of(results));

0 commit comments

Comments
 (0)