Skip to content

Commit f6d58a1

Browse files
committed
Remove writeables from index options
1 parent a1aaffc commit f6d58a1

File tree

2 files changed

+2
-124
lines changed

2 files changed

+2
-124
lines changed

server/src/main/java/org/elasticsearch/index/mapper/vectors/DenseVectorFieldMapper.java

Lines changed: 1 addition & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@
3838
import org.apache.lucene.util.BytesRef;
3939
import org.apache.lucene.util.VectorUtil;
4040
import org.elasticsearch.common.ParsingException;
41-
import org.elasticsearch.common.io.stream.StreamInput;
42-
import org.elasticsearch.common.io.stream.StreamOutput;
43-
import org.elasticsearch.common.io.stream.Writeable;
4441
import org.elasticsearch.common.settings.Setting;
4542
import org.elasticsearch.common.util.FeatureFlag;
4643
import org.elasticsearch.common.xcontent.support.XContentMapValues;
@@ -1318,10 +1315,6 @@ public abstract static class DenseVectorIndexOptions implements IndexOptions {
13181315
this.type = type;
13191316
}
13201317

1321-
DenseVectorIndexOptions(StreamInput in) throws IOException {
1322-
this.type = in.readEnum(VectorIndexType.class);
1323-
}
1324-
13251318
abstract KnnVectorsFormat getVectorsFormat(ElementType elementType);
13261319

13271320
public boolean validate(ElementType elementType, int dim, boolean throwOnError) {
@@ -1389,11 +1382,6 @@ abstract static class QuantizedIndexOptions extends DenseVectorIndexOptions {
13891382
super(type);
13901383
this.rescoreVector = rescoreVector;
13911384
}
1392-
1393-
QuantizedIndexOptions(StreamInput in) throws IOException {
1394-
super(in);
1395-
this.rescoreVector = in.readOptionalWriteable(RescoreVector::new);
1396-
}
13971385
}
13981386

13991387
public enum VectorIndexType {
@@ -1716,16 +1704,6 @@ static class Int8FlatIndexOptions extends QuantizedIndexOptions {
17161704
this.confidenceInterval = confidenceInterval;
17171705
}
17181706

1719-
Int8FlatIndexOptions(StreamInput in) throws IOException {
1720-
super(in);
1721-
confidenceInterval = in.readOptionalFloat();
1722-
}
1723-
1724-
@Override
1725-
public IndexOptions readFrom(StreamInput in) throws IOException {
1726-
return new Int8FlatIndexOptions(in);
1727-
}
1728-
17291707
@Override
17301708
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
17311709
builder.startObject();
@@ -1773,15 +1751,6 @@ static class FlatIndexOptions extends DenseVectorIndexOptions {
17731751
super(VectorIndexType.FLAT);
17741752
}
17751753

1776-
FlatIndexOptions(StreamInput in) throws IOException {
1777-
super(in);
1778-
}
1779-
1780-
@Override
1781-
public IndexOptions readFrom(StreamInput in) throws IOException {
1782-
return new FlatIndexOptions(in);
1783-
}
1784-
17851754
@Override
17861755
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
17871756
builder.startObject();
@@ -1828,18 +1797,6 @@ public Int4HnswIndexOptions(int m, int efConstruction, Float confidenceInterval,
18281797
this.confidenceInterval = confidenceInterval == null ? 0f : confidenceInterval;
18291798
}
18301799

1831-
Int4HnswIndexOptions(StreamInput in) throws IOException {
1832-
super(in);
1833-
m = in.readInt();
1834-
efConstruction = in.readInt();
1835-
confidenceInterval = in.readFloat();
1836-
}
1837-
1838-
@Override
1839-
public IndexOptions readFrom(StreamInput in) throws IOException {
1840-
return new Int4HnswIndexOptions(in);
1841-
}
1842-
18431800
@Override
18441801
public KnnVectorsFormat getVectorsFormat(ElementType elementType) {
18451802
assert elementType == ElementType.FLOAT;
@@ -1912,16 +1869,6 @@ static class Int4FlatIndexOptions extends QuantizedIndexOptions {
19121869
this.confidenceInterval = confidenceInterval == null ? 0f : confidenceInterval;
19131870
}
19141871

1915-
Int4FlatIndexOptions(StreamInput in) throws IOException {
1916-
super(in);
1917-
confidenceInterval = in.readFloat();
1918-
}
1919-
1920-
@Override
1921-
public IndexOptions readFrom(StreamInput in) throws IOException {
1922-
return new Int4FlatIndexOptions(in);
1923-
}
1924-
19251872
@Override
19261873
public KnnVectorsFormat getVectorsFormat(ElementType elementType) {
19271874
assert elementType == ElementType.FLOAT;
@@ -1981,18 +1928,6 @@ public Int8HnswIndexOptions(int m, int efConstruction, Float confidenceInterval,
19811928
this.confidenceInterval = confidenceInterval;
19821929
}
19831930

1984-
Int8HnswIndexOptions(StreamInput in) throws IOException {
1985-
super(in);
1986-
m = in.readInt();
1987-
efConstruction = in.readInt();
1988-
confidenceInterval = in.readFloat();
1989-
}
1990-
1991-
@Override
1992-
public IndexOptions readFrom(StreamInput in) throws IOException {
1993-
return new Int8HnswIndexOptions(in);
1994-
}
1995-
19961931
@Override
19971932
public KnnVectorsFormat getVectorsFormat(ElementType elementType) {
19981933
assert elementType == ElementType.FLOAT;
@@ -2074,17 +2009,6 @@ static class HnswIndexOptions extends DenseVectorIndexOptions {
20742009
this.efConstruction = efConstruction;
20752010
}
20762011

2077-
HnswIndexOptions(StreamInput in) throws IOException {
2078-
super(in);
2079-
m = in.readInt();
2080-
efConstruction = in.readInt();
2081-
}
2082-
2083-
@Override
2084-
public IndexOptions readFrom(StreamInput in) throws IOException {
2085-
return new HnswIndexOptions(in);
2086-
}
2087-
20882012
@Override
20892013
public KnnVectorsFormat getVectorsFormat(ElementType elementType) {
20902014
if (elementType == ElementType.BIT) {
@@ -2145,17 +2069,6 @@ public BBQHnswIndexOptions(int m, int efConstruction, RescoreVector rescoreVecto
21452069
this.efConstruction = efConstruction;
21462070
}
21472071

2148-
BBQHnswIndexOptions(StreamInput in) throws IOException {
2149-
super(in);
2150-
m = in.readInt();
2151-
efConstruction = in.readInt();
2152-
}
2153-
2154-
@Override
2155-
public IndexOptions readFrom(StreamInput in) throws IOException {
2156-
return new BBQHnswIndexOptions(in);
2157-
}
2158-
21592072
@Override
21602073
KnnVectorsFormat getVectorsFormat(ElementType elementType) {
21612074
assert elementType == ElementType.FLOAT;
@@ -2210,15 +2123,6 @@ static class BBQFlatIndexOptions extends QuantizedIndexOptions {
22102123
super(VectorIndexType.BBQ_FLAT, rescoreVector);
22112124
}
22122125

2213-
BBQFlatIndexOptions(StreamInput in) throws IOException {
2214-
super(in);
2215-
}
2216-
2217-
@Override
2218-
public IndexOptions readFrom(StreamInput in) throws IOException {
2219-
return new BBQFlatIndexOptions(in);
2220-
}
2221-
22222126
@Override
22232127
KnnVectorsFormat getVectorsFormat(ElementType elementType) {
22242128
assert elementType == ElementType.FLOAT;
@@ -2274,17 +2178,6 @@ static class BBQIVFIndexOptions extends QuantizedIndexOptions {
22742178
this.defaultNProbe = defaultNProbe;
22752179
}
22762180

2277-
BBQIVFIndexOptions(StreamInput in) throws IOException {
2278-
super(in);
2279-
clusterSize = in.readVInt();
2280-
defaultNProbe = in.readVInt();
2281-
}
2282-
2283-
@Override
2284-
public IndexOptions readFrom(StreamInput in) throws IOException {
2285-
return new BBQIVFIndexOptions(in);
2286-
}
2287-
22882181
@Override
22892182
KnnVectorsFormat getVectorsFormat(ElementType elementType) {
22902183
assert elementType == ElementType.FLOAT;
@@ -2323,14 +2216,10 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
23232216
}
23242217
}
23252218

2326-
public record RescoreVector(float oversample) implements ToXContentObject, Writeable {
2219+
public record RescoreVector(float oversample) implements ToXContentObject {
23272220
static final String NAME = "rescore_vector";
23282221
static final String OVERSAMPLE = "oversample";
23292222

2330-
RescoreVector(StreamInput in) throws IOException {
2331-
this(in.readFloat());
2332-
}
2333-
23342223
static RescoreVector fromIndexOptions(Map<String, ?> indexOptionsMap, IndexVersion indexVersion) {
23352224
Object rescoreVectorNode = indexOptionsMap.remove(NAME);
23362225
if (rescoreVectorNode == null) {
@@ -2360,11 +2249,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
23602249
builder.endObject();
23612250
return builder;
23622251
}
2363-
2364-
@Override
2365-
public void writeTo(StreamOutput out) throws IOException {
2366-
out.writeFloat(oversample);
2367-
}
23682252
}
23692253

23702254
public static final TypeParser PARSER = new TypeParser(

server/src/main/java/org/elasticsearch/index/mapper/vectors/IndexOptions.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,9 @@
99

1010
package org.elasticsearch.index.mapper.vectors;
1111

12-
import org.elasticsearch.common.io.stream.StreamInput;
1312
import org.elasticsearch.xcontent.ToXContent;
1413

15-
import java.io.IOException;
16-
1714
/**
1815
* Represents general index options that can be attached to a semantic or vector field.
1916
*/
20-
public interface IndexOptions extends ToXContent {
21-
22-
IndexOptions readFrom(StreamInput in) throws IOException;
23-
}
17+
public interface IndexOptions extends ToXContent {}

0 commit comments

Comments
 (0)