Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
8005a7d
Refresh potential lost connections at query start for field caps (#13…
pawankartik-elastic Jul 30, 2025
c04e6e5
Upgrade MinIO (& work around bug) (#131815)
DaveCTurner Jul 30, 2025
485b9cc
Mute org.elasticsearch.indices.cluster.FieldCapsForceConnectTimeoutIT…
elasticsearchmachine Jul 30, 2025
0e63c90
Support kNN filter on nested metadata (#113949)
mayya-sharipova Jul 30, 2025
15faa70
Extend HTTP timeout in repo analysis tests (#131744)
DaveCTurner Jul 30, 2025
8b3857b
Mute org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexType…
elasticsearchmachine Jul 30, 2025
c1d7e79
[Test] Fix test022InstallPluginsFromLocalArchive (#131353)
slobodanadamovic Jul 30, 2025
d56a476
[ES|QL] Implement new syntax for RERANK and COMPLETION (#129716)
afoucret Jul 30, 2025
6af55c2
Mute org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexType…
elasticsearchmachine Jul 30, 2025
0b0f4f8
Mute org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexType…
elasticsearchmachine Jul 30, 2025
650ce32
Remove index refresh block ITs (replaced by ITs in Serverless) (#132013)
benchaplin Jul 30, 2025
713d874
Enable entitlements for serverless tests (#131501)
mosche Jul 30, 2025
63b77a6
Hierarchical centroid storage for DiskBBQ (#132010)
iverase Jul 30, 2025
1485544
Test entitlements for shared data dir (MDP) (#132183)
mosche Jul 30, 2025
7b7d3f7
Unmute #132017 (#132092)
carlosdelest Jul 30, 2025
a78737d
Document failure behaviour for register ops (#132173)
DaveCTurner Jul 30, 2025
ccf9893
Fix race condition in `RemoteClusterService.collectNodes()` (#131937)
JeremyDahlgren Jul 30, 2025
72a8f7f
ESQL: Stabilize heap attack test (#132045)
nik9000 Jul 30, 2025
0695b15
ESQL: Bump Apache Arrow dependency (#132100)
nik9000 Jul 30, 2025
593f48f
Simulate ingest API uses existing index mapping when mapping_addition…
masseyke Jul 30, 2025
d507b26
ESQL: Speed up spec tests (#131949)
nik9000 Jul 30, 2025
067a812
Update IronBank base image to 9.6 (#131302)
brianseeders Jul 30, 2025
a231726
Mute org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexType…
elasticsearchmachine Jul 30, 2025
b15f972
Mute org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexType…
elasticsearchmachine Jul 30, 2025
3e8a295
Mute org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexType…
elasticsearchmachine Jul 30, 2025
830076e
Mute org.elasticsearch.xpack.security.authz.store.CompositeRolesStore…
elasticsearchmachine Jul 30, 2025
074f070
Suspend Index throttling when relocating (#128797)
ankikuma Jul 30, 2025
379263c
Mute org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexType…
elasticsearchmachine Jul 30, 2025
fe84d27
Mute org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexType…
elasticsearchmachine Jul 30, 2025
f7b0b9b
Mute org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexType…
elasticsearchmachine Jul 30, 2025
75a5977
Mute org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexType…
elasticsearchmachine Jul 30, 2025
31b0d6e
Mute org.elasticsearch.test.rest.yaml.MDPYamlTestSuiteIT test {yaml=m…
elasticsearchmachine Jul 30, 2025
6f88c16
Relocate `RemoteClusterService` methods only used in tests. (#132037)
JeremyDahlgren Jul 30, 2025
1badc53
Mute org.elasticsearch.xpack.logsdb.qa.StandardVersusStandardReindexe…
elasticsearchmachine Jul 30, 2025
2234e42
Mute org.elasticsearch.xpack.logsdb.qa.StoredSourceLogsDbVersusReinde…
elasticsearchmachine Jul 30, 2025
321b106
Mute org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexType…
elasticsearchmachine Jul 30, 2025
f7e3fe1
[ML] Adjust test case values due to changed memory reporting (#131981)
edsavage Jul 31, 2025
aa58fc7
[Security] Add entity store and asset criticality index privileges to…
opauloh Jul 31, 2025
3eab53c
Enable failure store for log data streams (#131261)
eyalkoren Jul 31, 2025
f39ccb5
[Test] Put shutdown marker on the last upgraded node only (#132157)
ywangd Jul 31, 2025
1bb9d2b
Mute org.elasticsearch.index.mapper.vectors.DenseVectorFieldIndexType…
elasticsearchmachine Jul 31, 2025
fe4a523
Fix DenseVectorFieldIndexTypeUpdateIT test (#132176)
carlosdelest Jul 31, 2025
bd2cd2c
[Test] Actually invoke the listener on failure case (#132229)
ywangd Jul 31, 2025
cf11a59
Add known issue for bbq_hnsw rescoring (#132009)
thecoop Jul 31, 2025
3dc75ff
ESQL: Fix StdDev test for NaN results (#132195)
ivancea Jul 31, 2025
4ef3fbd
Mute org.elasticsearch.xpack.sql.qa.mixed_node.SqlCompatIT testNullsO…
elasticsearchmachine Jul 31, 2025
892d88b
[Test] Fix CompositeRolesStoreTests testCacheCleanupOnProjectDeletion…
slobodanadamovic Jul 31, 2025
e06e447
Finalize release notes for v9.1.0 release (#132065)
elasticsearchmachine Jul 31, 2025
0b9f15a
ESQL: Reenable INLINESTATS telemetry test (#132197)
bpintea Jul 31, 2025
1f3039a
ESQL: Reenable INLINESTATS tests (#132200)
bpintea Jul 31, 2025
ff06e46
Introduce an Int7VectorScorer for scoring 7-bit quantize vectors (#13…
iverase Jul 31, 2025
1c91d5b
Merge branch 'main' into lucene_snapshot
ChrisHegarty Jul 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
package org.elasticsearch.benchmark.vector;

import org.apache.lucene.index.VectorSimilarityFunction;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IOContext;
import org.apache.lucene.store.IndexInput;
import org.apache.lucene.store.IndexOutput;
import org.apache.lucene.store.MMapDirectory;
import org.apache.lucene.util.quantization.OptimizedScalarQuantizer;
import org.elasticsearch.common.logging.LogConfigurator;
import org.elasticsearch.core.IOUtils;
import org.elasticsearch.simdvec.ES91Int4VectorsScorer;
import org.elasticsearch.simdvec.ES92Int7VectorsScorer;
import org.elasticsearch.simdvec.internal.vectorization.ESVectorizationProvider;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Param;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.infra.Blackhole;

import java.io.IOException;
import java.nio.file.Files;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;

@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@State(Scope.Benchmark)
// first iteration is complete garbage, so make sure we really warmup
@Warmup(iterations = 4, time = 1)
// real iterations. not useful to spend tons of time here, better to fork more
@Measurement(iterations = 5, time = 1)
// engage some noise reduction
@Fork(value = 1)
public class Int7ScorerBenchmark {

static {
LogConfigurator.configureESLogging(); // native access requires logging to be initialized
}

@Param({ "384", "782", "1024" })
int dims;

int numVectors = 20 * ES92Int7VectorsScorer.BULK_SIZE;
int numQueries = 5;

byte[] scratch;
byte[][] binaryVectors;
byte[][] binaryQueries;
float[] scores = new float[ES92Int7VectorsScorer.BULK_SIZE];

ES92Int7VectorsScorer scorer;
Directory dir;
IndexInput in;

OptimizedScalarQuantizer.QuantizationResult queryCorrections;
float centroidDp;

@Setup
public void setup() throws IOException {
binaryVectors = new byte[numVectors][dims];
dir = new MMapDirectory(Files.createTempDirectory("vectorData"));
try (IndexOutput out = dir.createOutput("vectors", IOContext.DEFAULT)) {
for (byte[] binaryVector : binaryVectors) {
for (int i = 0; i < dims; i++) {
// 4-bit quantization
binaryVector[i] = (byte) ThreadLocalRandom.current().nextInt(128);
}
out.writeBytes(binaryVector, 0, binaryVector.length);
ThreadLocalRandom.current().nextBytes(binaryVector);
out.writeBytes(binaryVector, 0, 16); // corrections
}
}

queryCorrections = new OptimizedScalarQuantizer.QuantizationResult(
ThreadLocalRandom.current().nextFloat(),
ThreadLocalRandom.current().nextFloat(),
ThreadLocalRandom.current().nextFloat(),
Short.toUnsignedInt((short) ThreadLocalRandom.current().nextInt())
);
centroidDp = ThreadLocalRandom.current().nextFloat();

in = dir.openInput("vectors", IOContext.DEFAULT);
binaryQueries = new byte[numVectors][dims];
for (byte[] binaryVector : binaryVectors) {
for (int i = 0; i < dims; i++) {
// 7-bit quantization
binaryVector[i] = (byte) ThreadLocalRandom.current().nextInt(128);
}
}

scratch = new byte[dims];
scorer = ESVectorizationProvider.getInstance().newES92Int7VectorsScorer(in, dims);
}

@TearDown
public void teardown() throws IOException {
IOUtils.close(dir, in);
}

@Benchmark
@Fork(jvmArgsPrepend = { "--add-modules=jdk.incubator.vector" })
public void scoreFromMemorySegment(Blackhole bh) throws IOException {
for (int j = 0; j < numQueries; j++) {
in.seek(0);
for (int i = 0; i < numVectors; i++) {
bh.consume(
scorer.score(
binaryQueries[j],
queryCorrections.lowerInterval(),
queryCorrections.upperInterval(),
queryCorrections.quantizedComponentSum(),
queryCorrections.additionalCorrection(),
VectorSimilarityFunction.EUCLIDEAN,
centroidDp
)
);
}
}
}

@Benchmark
@Fork(jvmArgsPrepend = { "--add-modules=jdk.incubator.vector" })
public void scoreFromMemorySegmentBulk(Blackhole bh) throws IOException {
for (int j = 0; j < numQueries; j++) {
in.seek(0);
for (int i = 0; i < numVectors; i += ES91Int4VectorsScorer.BULK_SIZE) {
scorer.scoreBulk(
binaryQueries[j],
queryCorrections.lowerInterval(),
queryCorrections.upperInterval(),
queryCorrections.quantizedComponentSum(),
queryCorrections.additionalCorrection(),
VectorSimilarityFunction.EUCLIDEAN,
centroidDp,
scores
);
for (float score : scores) {
bh.consume(score);
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,9 @@ public void apply(Project project) {
task.into("META-INF", copy -> copy.from(testBuildInfoTask));
});

if (project.getRootProject().getName().equals("elasticsearch")) {
project.getTasks()
.withType(Test.class)
.matching(test -> List.of("test", "internalClusterTest").contains(test.getName()))
.configureEach(test -> {
test.systemProperty("es.entitlement.enableForTests", "true");
});
}
project.getTasks()
.withType(Test.class)
.matching(test -> List.of("test", "internalClusterTest").contains(test.getName()))
.configureEach(test -> test.getSystemProperties().putIfAbsent("es.entitlement.enableForTests", "true"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ tags:
# Build args passed to Dockerfile ARGs
args:
BASE_IMAGE: "redhat/ubi/ubi9"
BASE_TAG: "9.5"
BASE_TAG: "9.6"
# Docker image labels
labels:
org.opencontainers.image.title: "elasticsearch"
Expand Down
7 changes: 7 additions & 0 deletions docs/changelog/113949.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pr: 113949
summary: Support kNN filter on nested metadata
area: Vector Search
type: enhancement
issues:
- 128803
- 106994
6 changes: 6 additions & 0 deletions docs/changelog/129662.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 129662
summary: "[Security] Add entity store and asset criticality index privileges to built\
\ in Editor, Viewer and Kibana System roles"
area: Authorization
type: enhancement
issues: []
13 changes: 13 additions & 0 deletions docs/changelog/131261.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
pr: 131261
summary: Enable Failure Store for new logs-*-* data streams
area: Data streams
type: feature
issues:
- 131105
highlight:
title: Enable Failure Store for new logs data streams
body: |-
The [Failure Store](docs-content://manage-data/data-store/data-streams/failure-store.md) is now enabled by default for new logs data streams matching the pattern `logs-*-*`. This means that such data streams will now store invalid documents in a
dedicated failure index instead of rejecting them, allowing better visibility and control over data quality issues without loosing data. This can be [enabled manually](docs-content://manage-data/data-store/data-streams/failure-store.md#set-up-failure-store-existing) for existing data streams.
Note: With the failure store enabled, the http response code clients receive when indexing invalid documents will change from `400 Bad Request` to `201 Created`, with an additional response attribute `"failure_store" : "used"`.
notable: true
5 changes: 5 additions & 0 deletions docs/changelog/131517.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 131517
summary: Refresh potential lost connections at query start for field caps
area: Search
type: enhancement
issues: []
5 changes: 5 additions & 0 deletions docs/changelog/131937.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 131937
summary: Fix race condition in `RemoteClusterService.collectNodes()`
area: Distributed
type: bug
issues: []
6 changes: 6 additions & 0 deletions docs/changelog/132101.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 132101
summary: Simulate ingest API uses existing index mapping when `mapping_addition` is
given
area: Ingest Node
type: bug
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,26 @@ The `COMPLETION` command allows you to send prompts and context to a Large Langu

**Syntax**

::::{tab-set}

:::{tab-item} 9.2.0+

```esql
COMPLETION [column =] prompt WITH inference_id
COMPLETION [column =] prompt WITH { "inference_id" : "my_inference_endpoint" }
```

:::

:::{tab-item} 9.1.x only

```esql
COMPLETION [column =] prompt WITH my_inference_endpoint
```

:::

::::

**Parameters**

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

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

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

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


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

```esql
ROW question = "What is Elasticsearch?"
| COMPLETION question WITH test_completion_model
| COMPLETION question WITH { "inference_id" : "my_inference_endpoint" }
| KEEP question, completion
```

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

```esql
ROW question = "What is Elasticsearch?"
| COMPLETION answer = question WITH test_completion_model
| COMPLETION answer = question WITH { "inference_id" : "my_inference_endpoint" }
| KEEP question, answer
```

Expand All @@ -117,7 +133,7 @@ FROM movies
"Synopsis: ", synopsis, "\n",
"Actors: ", MV_CONCAT(actors, ", "), "\n",
)
| COMPLETION summary = prompt WITH test_completion_model
| COMPLETION summary = prompt WITH { "inference_id" : "my_inference_endpoint" }
| KEEP title, summary, rating
```

Expand Down
59 changes: 51 additions & 8 deletions docs/reference/query-languages/query-dsl/query-dsl-knn-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,19 @@ POST my-image-index/_search
`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):

* kNN search over nested dense_vectors diversifies the top results over the top-level document
* `filter` over the top-level document metadata is supported and acts as a pre-filter
* `filter` over `nested` field metadata is not supported
* `filter` both over the top-level document metadata and `nested` is supported and acts as a pre-filter

::::{note}
To ensure correct results: each individual filter must be either over
the top-level metadata or `nested` metadata. However, a single knn query
supports multiple filters, where some filters can be over the top-level
metadata and some over nested.
::::

A sample query can look like below:

Below is a sample query with filter over nested metadata.
For scoring parents' documents, this query only considers vectors that
have "paragraph.language" set to "EN".

```json
{
Expand All @@ -215,12 +224,46 @@ A sample query can look like below:
"path" : "paragraph",
"query" : {
"knn": {
"query_vector": [
0.45,
45
],
"query_vector": [0.45, 0.50],
"field": "paragraph.vector",
"num_candidates": 2
"filter": {
"match": {
"paragraph.language": "EN"
}
}
}
}
}
}
}
```

Below is a sample query with two filters: one over nested metadata
and another over the top level metadata. For scoring parents' documents,
this query only considers vectors whose parent's title contain "essay"
word and have "paragraph.language" set to "EN".

```json
{
"query" : {
"nested" : {
"path" : "paragraph",
"query" : {
"knn": {
"query_vector": [0.45, 0.50],
"field": "paragraph.vector",
"filter": [
{
"match": {
"paragraph.language": "EN"
}
},
{
"match": {
"title": "essay"
}
}
]
}
}
}
Expand Down
Loading
Loading