Skip to content

Commit 81cc7ca

Browse files
authored
Merge branch 'main' into fork_grammar_update
2 parents 7adee7a + f7c1294 commit 81cc7ca

File tree

13 files changed

+221
-64
lines changed

13 files changed

+221
-64
lines changed

build-tools-internal/gradle/wrapper/gradle-wrapper.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionSha256Sum=d7042b3c11565c192041fc8c4703f541b888286404b4f267138c1d094d8ecdca
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-all.zip
3+
distributionSha256Sum=443c9c8ee2ac1ee0e11881a40f2376d79c66386264a44b24a9f8ca67e633375f
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-all.zip
55
networkTimeout=10000
66
validateDistributionUrl=true
77
zipStoreBase=GRADLE_USER_HOME
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.14.1
1+
8.14.2

docs/changelog/128913.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 128913
2+
summary: "[apm-data] Enable 'date_detection' for all apm data streams"
3+
area: Data streams
4+
type: enhancement
5+
issues: []

docs/changelog/129164.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 129164
2+
summary: Log partial failures
3+
area: ES|QL
4+
type: feature
5+
issues: []

docs/reference/query-languages/esql/_snippets/lists/search-functions.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22
* [preview] [`MATCH`](../../functions-operators/search-functions.md#esql-match)
33
* [preview] [`MATCH_PHRASE`](../../functions-operators/search-functions.md#esql-match_phrase)
44
* [preview] [`QSTR`](../../functions-operators/search-functions.md#esql-qstr)
5-
% * [preview] [
6-
`TERM`](../../functions-operators/search-functions.md#esql-term)
5+
% * [preview] [`TERM`](../../functions-operators/search-functions.md#esql-term)

gradle/wrapper/gradle-wrapper.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionSha256Sum=d7042b3c11565c192041fc8c4703f541b888286404b4f267138c1d094d8ecdca
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-all.zip
3+
distributionSha256Sum=443c9c8ee2ac1ee0e11881a40f2376d79c66386264a44b24a9f8ca67e633375f
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-all.zip
55
networkTimeout=10000
66
validateDistributionUrl=true
77
zipStoreBase=GRADLE_USER_HOME

plugins/examples/gradle/wrapper/gradle-wrapper.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionSha256Sum=d7042b3c11565c192041fc8c4703f541b888286404b4f267138c1d094d8ecdca
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-all.zip
3+
distributionSha256Sum=443c9c8ee2ac1ee0e11881a40f2376d79c66386264a44b24a9f8ca67e633375f
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-all.zip
55
networkTimeout=10000
66
validateDistributionUrl=true
77
zipStoreBase=GRADLE_USER_HOME

server/src/main/java/org/elasticsearch/index/codec/vectors/DefaultIVFVectorsReader.java

Lines changed: 6 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
import org.apache.lucene.codecs.hnsw.FlatVectorsReader;
1313
import org.apache.lucene.index.FieldInfo;
14-
import org.apache.lucene.index.FloatVectorValues;
1514
import org.apache.lucene.index.SegmentReadState;
1615
import org.apache.lucene.index.VectorSimilarityFunction;
1716
import org.apache.lucene.search.KnnCollector;
@@ -20,10 +19,12 @@
2019
import org.apache.lucene.util.VectorUtil;
2120
import org.apache.lucene.util.hnsw.NeighborQueue;
2221
import org.apache.lucene.util.quantization.OptimizedScalarQuantizer;
22+
import org.elasticsearch.index.codec.vectors.reflect.OffHeapStats;
2323
import org.elasticsearch.simdvec.ES91OSQVectorsScorer;
2424
import org.elasticsearch.simdvec.ESVectorUtil;
2525

2626
import java.io.IOException;
27+
import java.util.Map;
2728
import java.util.function.IntPredicate;
2829

2930
import static org.apache.lucene.codecs.lucene102.Lucene102BinaryQuantizedVectorsFormat.QUERY_BITS;
@@ -38,7 +39,7 @@
3839
* Default implementation of {@link IVFVectorsReader}. It scores the posting lists centroids using
3940
* brute force and then scores the top ones using the posting list.
4041
*/
41-
public class DefaultIVFVectorsReader extends IVFVectorsReader {
42+
public class DefaultIVFVectorsReader extends IVFVectorsReader implements OffHeapStats {
4243
private static final float FOUR_BIT_SCALE = 1f / ((1 << 4) - 1);
4344

4445
public DefaultIVFVectorsReader(SegmentReadState state, FlatVectorsReader rawVectorsReader) throws IOException {
@@ -163,57 +164,9 @@ static float int4QuantizedScore(
163164
}
164165
}
165166

166-
static class OffHeapCentroidFloatVectorValues extends FloatVectorValues {
167-
private final int numCentroids;
168-
private final IndexInput input;
169-
private final int dimension;
170-
private final float[] centroid;
171-
private final long centroidByteSize;
172-
private int ord = -1;
173-
174-
OffHeapCentroidFloatVectorValues(int numCentroids, IndexInput input, int dimension) {
175-
this.numCentroids = numCentroids;
176-
this.input = input;
177-
this.dimension = dimension;
178-
this.centroid = new float[dimension];
179-
this.centroidByteSize = dimension + 3 * Float.BYTES + Short.BYTES;
180-
}
181-
182-
@Override
183-
public float[] vectorValue(int ord) throws IOException {
184-
if (ord < 0 || ord >= numCentroids) {
185-
throw new IllegalArgumentException("ord must be in [0, " + numCentroids + "]");
186-
}
187-
if (ord == this.ord) {
188-
return centroid;
189-
}
190-
readQuantizedCentroid(ord);
191-
return centroid;
192-
}
193-
194-
private void readQuantizedCentroid(int centroidOrdinal) throws IOException {
195-
if (centroidOrdinal == ord) {
196-
return;
197-
}
198-
input.seek(numCentroids * centroidByteSize + (long) Float.BYTES * dimension * centroidOrdinal);
199-
input.readFloats(centroid, 0, centroid.length);
200-
ord = centroidOrdinal;
201-
}
202-
203-
@Override
204-
public int dimension() {
205-
return dimension;
206-
}
207-
208-
@Override
209-
public int size() {
210-
return numCentroids;
211-
}
212-
213-
@Override
214-
public FloatVectorValues copy() throws IOException {
215-
return new OffHeapCentroidFloatVectorValues(numCentroids, input.clone(), dimension);
216-
}
167+
@Override
168+
public Map<String, Long> getOffHeapByteSize(FieldInfo fieldInfo) {
169+
return Map.of();
217170
}
218171

219172
private static class MemorySegmentPostingsVisitor implements PostingVisitor {

server/src/test/java/org/elasticsearch/index/codec/vectors/IVFVectorsFormatTests.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,25 @@
1313
import org.apache.lucene.codecs.Codec;
1414
import org.apache.lucene.codecs.FilterCodec;
1515
import org.apache.lucene.codecs.KnnVectorsFormat;
16+
import org.apache.lucene.codecs.KnnVectorsReader;
17+
import org.apache.lucene.codecs.perfield.PerFieldKnnVectorsFormat;
18+
import org.apache.lucene.document.Document;
19+
import org.apache.lucene.document.KnnFloatVectorField;
20+
import org.apache.lucene.index.CodecReader;
21+
import org.apache.lucene.index.DirectoryReader;
22+
import org.apache.lucene.index.IndexReader;
23+
import org.apache.lucene.index.IndexWriter;
24+
import org.apache.lucene.index.LeafReader;
1625
import org.apache.lucene.index.VectorEncoding;
1726
import org.apache.lucene.index.VectorSimilarityFunction;
27+
import org.apache.lucene.store.Directory;
1828
import org.apache.lucene.tests.index.BaseKnnVectorsFormatTestCase;
1929
import org.apache.lucene.tests.util.TestUtil;
2030
import org.elasticsearch.common.logging.LogConfigurator;
31+
import org.elasticsearch.index.codec.vectors.reflect.OffHeapByteSizeUtils;
2132
import org.junit.Before;
2233

34+
import java.io.IOException;
2335
import java.util.List;
2436
import java.util.Locale;
2537

@@ -94,4 +106,26 @@ public void testLimits() {
94106
expectThrows(IllegalArgumentException.class, () -> new IVFVectorsFormat(MIN_VECTORS_PER_CLUSTER - 1));
95107
expectThrows(IllegalArgumentException.class, () -> new IVFVectorsFormat(MAX_VECTORS_PER_CLUSTER + 1));
96108
}
109+
110+
public void testSimpleOffHeapSize() throws IOException {
111+
float[] vector = randomVector(random().nextInt(12, 500));
112+
try (Directory dir = newDirectory(); IndexWriter w = new IndexWriter(dir, newIndexWriterConfig())) {
113+
Document doc = new Document();
114+
doc.add(new KnnFloatVectorField("f", vector, VectorSimilarityFunction.EUCLIDEAN));
115+
w.addDocument(doc);
116+
w.commit();
117+
try (IndexReader reader = DirectoryReader.open(w)) {
118+
LeafReader r = getOnlyLeafReader(reader);
119+
if (r instanceof CodecReader codecReader) {
120+
KnnVectorsReader knnVectorsReader = codecReader.getVectorReader();
121+
if (knnVectorsReader instanceof PerFieldKnnVectorsFormat.FieldsReader fieldsReader) {
122+
knnVectorsReader = fieldsReader.getFieldReader("f");
123+
}
124+
var fieldInfo = r.getFieldInfos().fieldInfo("f");
125+
var offHeap = OffHeapByteSizeUtils.getOffHeapByteSize(knnVectorsReader, fieldInfo);
126+
assertEquals(0, offHeap.size());
127+
}
128+
}
129+
}
130+
}
97131
}

x-pack/plugin/apm-data/src/main/resources/component-templates/[email protected]

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ _meta:
44
managed: true
55
template:
66
mappings:
7-
date_detection: false
87
dynamic: true
98
dynamic_templates:
109
- numeric_labels:

0 commit comments

Comments
 (0)