Skip to content

Commit e4396f7

Browse files
Merge remote-tracking branch 'elastic/main' into painless-savings
2 parents 24475d8 + af93900 commit e4396f7

File tree

196 files changed

+1302
-1405
lines changed

Some content is hidden

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

196 files changed

+1302
-1405
lines changed

.buildkite/pipelines/periodic.template.yml

-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ steps:
8585
- graalvm-ce17
8686
- openjdk17
8787
- openjdk21
88-
- openjdk22
8988
GRADLE_TASK:
9089
- checkPart1
9190
- checkPart2
@@ -108,7 +107,6 @@ steps:
108107
- graalvm-ce17
109108
- openjdk17
110109
- openjdk21
111-
- openjdk22
112110
BWC_VERSION: $BWC_LIST
113111
agents:
114112
provider: gcp

.buildkite/pipelines/periodic.yml

-2
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,6 @@ steps:
416416
- graalvm-ce17
417417
- openjdk17
418418
- openjdk21
419-
- openjdk22
420419
GRADLE_TASK:
421420
- checkPart1
422421
- checkPart2
@@ -439,7 +438,6 @@ steps:
439438
- graalvm-ce17
440439
- openjdk17
441440
- openjdk21
442-
- openjdk22
443441
BWC_VERSION: ["7.17.20", "8.13.1", "8.14.0"]
444442
agents:
445443
provider: gcp

build-conventions/src/main/java/org/elasticsearch/gradle/internal/conventions/precommit/LicenseHeadersTask.java

+22-5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.gradle.api.file.FileCollection;
2626
import org.gradle.api.file.ProjectLayout;
2727
import org.gradle.api.file.RegularFileProperty;
28+
import org.gradle.api.model.ObjectFactory;
2829
import org.gradle.api.provider.ListProperty;
2930
import org.gradle.api.tasks.CacheableTask;
3031
import org.gradle.api.tasks.IgnoreEmptyDirectories;
@@ -39,21 +40,22 @@
3940
import org.w3c.dom.Element;
4041
import org.w3c.dom.NodeList;
4142
import org.xml.sax.SAXException;
42-
import org.gradle.api.model.ObjectFactory;
43-
import javax.xml.parsers.DocumentBuilderFactory;
44-
import javax.xml.parsers.ParserConfigurationException;
43+
4544
import java.io.BufferedWriter;
4645
import java.io.File;
4746
import java.io.FileWriter;
4847
import java.io.IOException;
48+
import java.io.Serializable;
4949
import java.io.Writer;
5050
import java.nio.file.Files;
5151
import java.util.ArrayList;
5252
import java.util.Arrays;
5353
import java.util.List;
5454
import java.util.stream.Collectors;
5555
import javax.inject.Inject;
56-
import java.io.Serializable;
56+
import javax.xml.XMLConstants;
57+
import javax.xml.parsers.DocumentBuilderFactory;
58+
import javax.xml.parsers.ParserConfigurationException;
5759

5860
/**
5961
* Checks files for license headers..
@@ -232,7 +234,7 @@ private ClaimStatistic toXmlReportFile(ReportConfiguration config, Writer writer
232234

233235
private static List<String> unapprovedFiles(File xmlReportFile) {
234236
try {
235-
NodeList resourcesNodes = DocumentBuilderFactory.newInstance()
237+
NodeList resourcesNodes = createXmlDocumentBuilderFactory()
236238
.newDocumentBuilder()
237239
.parse(xmlReportFile)
238240
.getElementsByTagName("resource");
@@ -249,6 +251,21 @@ private static List<String> unapprovedFiles(File xmlReportFile) {
249251
}
250252
}
251253

254+
private static DocumentBuilderFactory createXmlDocumentBuilderFactory() throws ParserConfigurationException {
255+
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
256+
dbf.setXIncludeAware(false);
257+
dbf.setIgnoringComments(true);
258+
dbf.setExpandEntityReferences(false);
259+
dbf.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
260+
dbf.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
261+
dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
262+
dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
263+
dbf.setFeature("http://xml.org/sax/features/external-general-entities", false);
264+
dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
265+
dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
266+
return dbf;
267+
}
268+
252269
private static List<Element> elementList(NodeList resourcesNodes) {
253270
List<Element> nodeList = new ArrayList<>(resourcesNodes.getLength());
254271
for (int idx = 0; idx < resourcesNodes.getLength(); idx++) {

docs/changelog/106516.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 106516
2+
summary: "ESQL: perform a reduction on the data node"
3+
area: ES|QL
4+
type: enhancement
5+
issues: []

docs/changelog/106836.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 106836
2+
summary: Make int8_hnsw our default index for new dense-vector fields
3+
area: Mapping
4+
type: enhancement
5+
issues: []

docs/reference/mapping/types/dense-vector.asciidoc

+6-4
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ data structure to support fast kNN retrieval through the <<search-api-knn, `knn`
6565
Unmapped array fields of float elements with size between 128 and 4096 are dynamically mapped as `dense_vector` with a default similariy of `cosine`.
6666
You can override the default similarity by explicitly mapping the field as `dense_vector` with the desired similarity.
6767

68-
Indexing is enabled by default for dense vector fields.
68+
Indexing is enabled by default for dense vector fields and indexed as `int8_hnsw`.
6969
When indexing is enabled, you can define the vector similarity to use in kNN search:
7070

7171
[source,console]
@@ -116,7 +116,8 @@ that sacrifices result accuracy for improved speed.
116116

117117
The `dense_vector` type supports quantization to reduce the memory footprint required when <<approximate-knn, searching>> `float` vectors.
118118
Currently the only quantization method supported is `int8` and provided vectors `element_type` must be `float`. To use
119-
a quantized index, you can set your index type to `int8_hnsw`.
119+
a quantized index, you can set your index type to `int8_hnsw`. When indexing `float` vectors, the current default
120+
index type is `int8_hnsw`.
120121

121122
When using the `int8_hnsw` index, each of the `float` vectors' dimensions are quantized to 1-byte integers. This can
122123
reduce the memory footprint by as much as 75% at the cost of some accuracy. However, the disk usage can increase by
@@ -240,9 +241,10 @@ expense of slower indexing speed.
240241
The type of kNN algorithm to use. Can be either any of:
241242
+
242243
--
243-
* `hnsw` - The default storage type. This utilizes the https://arxiv.org/abs/1603.09320[HNSW algorithm] for scalable
244+
* `hnsw` - This utilizes the https://arxiv.org/abs/1603.09320[HNSW algorithm] for scalable
244245
approximate kNN search. This supports all `element_type` values.
245-
* `int8_hnsw` - This utilizes the https://arxiv.org/abs/1603.09320[HNSW algorithm] in addition to automatically scalar
246+
* `int8_hnsw` - The default index type for float vectors.
247+
This utilizes the https://arxiv.org/abs/1603.09320[HNSW algorithm] in addition to automatically scalar
246248
quantization for scalable approximate kNN search with `element_type` of `float`. This can reduce the memory footprint
247249
by 4x at the cost of some accuracy. See <<dense-vector-quantization, Automatically quantize vectors for kNN search>>.
248250
* `flat` - This utilizes a brute-force search algorithm for exact kNN search. This supports all `element_type` values.

docs/reference/search/search-your-data/knn-search.asciidoc

+6-1
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,8 @@ If you want to provide `float` vectors, but want the memory savings of `byte` ve
272272
internally they are indexed as `byte` vectors. Additionally, the original `float` vectors are still retained
273273
in the index.
274274

275+
NOTE: The default index type for `dense_vector` is `int8_hnsw`.
276+
275277
To use quantization, you can use the index type `int8_hnsw` object in the `dense_vector` mapping.
276278

277279
[source,console]
@@ -652,7 +654,10 @@ PUT passage_vectors
652654
"properties": {
653655
"vector": {
654656
"type": "dense_vector",
655-
"dims": 2
657+
"dims": 2,
658+
"index_options": {
659+
"type": "hnsw"
660+
}
656661
},
657662
"text": {
658663
"type": "text",

modules/data-streams/src/internalClusterTest/java/org/elasticsearch/datastreams/TSDBIndexingIT.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
package org.elasticsearch.datastreams;
99

1010
import org.elasticsearch.action.DocWriteRequest;
11-
import org.elasticsearch.action.admin.indices.diskusage.AnalyzeIndexDiskUsageAction;
1211
import org.elasticsearch.action.admin.indices.diskusage.AnalyzeIndexDiskUsageRequest;
12+
import org.elasticsearch.action.admin.indices.diskusage.TransportAnalyzeIndexDiskUsageAction;
1313
import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeRequest;
1414
import org.elasticsearch.action.admin.indices.get.GetIndexRequest;
1515
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
@@ -468,7 +468,7 @@ public void testTrimId() throws Exception {
468468

469469
// Pre check whether _id stored field uses diskspace:
470470
var diskUsageResponse = client().execute(
471-
AnalyzeIndexDiskUsageAction.INSTANCE,
471+
TransportAnalyzeIndexDiskUsageAction.TYPE,
472472
new AnalyzeIndexDiskUsageRequest(new String[] { dataStreamName }, AnalyzeIndexDiskUsageRequest.DEFAULT_INDICES_OPTIONS, true)
473473
).actionGet();
474474
var map = XContentHelper.convertToMap(XContentType.JSON.xContent(), Strings.toString(diskUsageResponse), false);
@@ -510,7 +510,7 @@ public void testTrimId() throws Exception {
510510

511511
// Check the _id stored field uses no disk space:
512512
diskUsageResponse = client().execute(
513-
AnalyzeIndexDiskUsageAction.INSTANCE,
513+
TransportAnalyzeIndexDiskUsageAction.TYPE,
514514
new AnalyzeIndexDiskUsageRequest(new String[] { dataStreamName }, AnalyzeIndexDiskUsageRequest.DEFAULT_INDICES_OPTIONS, true)
515515
).actionGet();
516516
map = XContentHelper.convertToMap(XContentType.JSON.xContent(), Strings.toString(diskUsageResponse), false);

modules/data-streams/src/main/java/org/elasticsearch/datastreams/lifecycle/DataStreamLifecycleService.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
import org.elasticsearch.action.admin.indices.delete.TransportDeleteIndexAction;
2020
import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeAction;
2121
import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeRequest;
22-
import org.elasticsearch.action.admin.indices.readonly.AddIndexBlockAction;
2322
import org.elasticsearch.action.admin.indices.readonly.AddIndexBlockRequest;
2423
import org.elasticsearch.action.admin.indices.readonly.AddIndexBlockResponse;
24+
import org.elasticsearch.action.admin.indices.readonly.TransportAddIndexBlockAction;
2525
import org.elasticsearch.action.admin.indices.rollover.RolloverAction;
2626
import org.elasticsearch.action.admin.indices.rollover.RolloverConfiguration;
2727
import org.elasticsearch.action.admin.indices.rollover.RolloverRequest;
@@ -738,7 +738,7 @@ private void addIndexBlockOnce(String indexName) {
738738
transportActionsDeduplicator.executeOnce(
739739
addIndexBlockRequest,
740740
new ErrorRecordingActionListener(
741-
AddIndexBlockAction.NAME,
741+
TransportAddIndexBlockAction.TYPE.name(),
742742
indexName,
743743
errorStore,
744744
Strings.format("Data stream lifecycle service encountered an error trying to mark index [%s] as readonly", indexName),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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 and the Server Side Public License, v 1; you may not use this file except
5+
* in compliance with, at your election, the Elastic License 2.0 or the Server
6+
* Side Public License, v 1.
7+
*/
8+
9+
package org.elasticsearch.kibana;
10+
11+
import org.elasticsearch.action.bulk.BulkResponse;
12+
import org.elasticsearch.action.support.WriteRequest;
13+
import org.elasticsearch.client.internal.Client;
14+
import org.elasticsearch.index.query.QueryBuilders;
15+
import org.elasticsearch.indices.SystemIndexThreadPoolTests;
16+
import org.elasticsearch.plugins.Plugin;
17+
18+
import java.util.Collection;
19+
import java.util.Map;
20+
import java.util.Set;
21+
22+
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
23+
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
24+
25+
public class KibanaThreadPoolTests extends SystemIndexThreadPoolTests {
26+
27+
@Override
28+
protected Collection<Class<? extends Plugin>> nodePlugins() {
29+
return Set.of(KibanaPlugin.class);
30+
}
31+
32+
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/106957")
33+
public void testKibanaThreadPool() {
34+
runWithBlockedThreadPools(() -> {
35+
// index documents
36+
String idToDelete = client().prepareIndex(".kibana").setSource(Map.of("foo", "delete me!")).get().getId();
37+
String idToUpdate = client().prepareIndex(".kibana").setSource(Map.of("foo", "update me!")).get().getId();
38+
39+
// bulk index, delete, and update
40+
Client bulkClient = client();
41+
BulkResponse response = bulkClient.prepareBulk(".kibana")
42+
.add(bulkClient.prepareIndex(".kibana").setSource(Map.of("foo", "search me!")))
43+
.add(bulkClient.prepareDelete(".kibana", idToDelete))
44+
.add(bulkClient.prepareUpdate().setId(idToUpdate).setDoc(Map.of("foo", "I'm updated!")))
45+
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
46+
.get();
47+
assertNoFailures(response);
48+
49+
// match-all search
50+
assertHitCount(client().prepareSearch(".kibana").setQuery(QueryBuilders.matchAllQuery()), 2);
51+
});
52+
}
53+
}

modules/mapper-extras/src/main/java/org/elasticsearch/index/mapper/extras/RankFeatureQueryBuilders.java

-65
This file was deleted.

qa/rolling-upgrade-legacy/src/test/resources/rest-api-spec/test/old_cluster/30_vector_search.yml

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
dims: 3
1919
index: true
2020
similarity: l2_norm
21+
index_options:
22+
type: hnsw
23+
m: 16
24+
ef_construction: 100
2125
- do:
2226
bulk:
2327
index: test-float-index

qa/system-indices/src/main/java/org/elasticsearch/system/indices/SystemIndicesQA.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
import java.util.function.Predicate;
4141
import java.util.function.Supplier;
4242

43-
import static org.elasticsearch.action.admin.cluster.node.tasks.get.GetTaskAction.TASKS_ORIGIN;
43+
import static org.elasticsearch.action.admin.cluster.node.tasks.get.TransportGetTaskAction.TASKS_ORIGIN;
4444
import static org.elasticsearch.index.mapper.MapperService.SINGLE_MAPPING_NAME;
4545
import static org.elasticsearch.rest.RestRequest.Method.POST;
4646
import static org.elasticsearch.rest.RestRequest.Method.PUT;

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search.vectors/100_knn_nested_search.yml

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ setup:
2323
dims: 5
2424
index: true
2525
similarity: l2_norm
26+
index_options:
27+
type: hnsw
28+
m: 16
29+
ef_construction: 200
2630

2731
- do:
2832
index:

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search.vectors/120_knn_query_multiple_shards.yml

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ setup:
1919
dims: 4
2020
index : true
2121
similarity : l2_norm
22+
index_options:
23+
type: hnsw
24+
m: 16
25+
ef_construction: 200
2226
my_name:
2327
type: keyword
2428
store: true

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search.vectors/140_knn_query_with_other_queries.yml

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ setup:
1919
dims: 4
2020
index : true
2121
similarity : l2_norm
22+
index_options:
23+
type: hnsw
24+
m: 16
25+
ef_construction: 200
2226
my_name:
2327
type: keyword
2428
store: true

0 commit comments

Comments
 (0)