|
38 | 38 | import org.apache.lucene.util.BytesRef; |
39 | 39 | import org.apache.lucene.util.VectorUtil; |
40 | 40 | 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; |
44 | 41 | import org.elasticsearch.common.settings.Setting; |
45 | 42 | import org.elasticsearch.common.util.FeatureFlag; |
46 | 43 | import org.elasticsearch.common.xcontent.support.XContentMapValues; |
@@ -1318,10 +1315,6 @@ public abstract static class DenseVectorIndexOptions implements IndexOptions { |
1318 | 1315 | this.type = type; |
1319 | 1316 | } |
1320 | 1317 |
|
1321 | | - DenseVectorIndexOptions(StreamInput in) throws IOException { |
1322 | | - this.type = in.readEnum(VectorIndexType.class); |
1323 | | - } |
1324 | | - |
1325 | 1318 | abstract KnnVectorsFormat getVectorsFormat(ElementType elementType); |
1326 | 1319 |
|
1327 | 1320 | public boolean validate(ElementType elementType, int dim, boolean throwOnError) { |
@@ -1389,11 +1382,6 @@ abstract static class QuantizedIndexOptions extends DenseVectorIndexOptions { |
1389 | 1382 | super(type); |
1390 | 1383 | this.rescoreVector = rescoreVector; |
1391 | 1384 | } |
1392 | | - |
1393 | | - QuantizedIndexOptions(StreamInput in) throws IOException { |
1394 | | - super(in); |
1395 | | - this.rescoreVector = in.readOptionalWriteable(RescoreVector::new); |
1396 | | - } |
1397 | 1385 | } |
1398 | 1386 |
|
1399 | 1387 | public enum VectorIndexType { |
@@ -1716,16 +1704,6 @@ static class Int8FlatIndexOptions extends QuantizedIndexOptions { |
1716 | 1704 | this.confidenceInterval = confidenceInterval; |
1717 | 1705 | } |
1718 | 1706 |
|
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 | | - |
1729 | 1707 | @Override |
1730 | 1708 | public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { |
1731 | 1709 | builder.startObject(); |
@@ -1773,15 +1751,6 @@ static class FlatIndexOptions extends DenseVectorIndexOptions { |
1773 | 1751 | super(VectorIndexType.FLAT); |
1774 | 1752 | } |
1775 | 1753 |
|
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 | | - |
1785 | 1754 | @Override |
1786 | 1755 | public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { |
1787 | 1756 | builder.startObject(); |
@@ -1828,18 +1797,6 @@ public Int4HnswIndexOptions(int m, int efConstruction, Float confidenceInterval, |
1828 | 1797 | this.confidenceInterval = confidenceInterval == null ? 0f : confidenceInterval; |
1829 | 1798 | } |
1830 | 1799 |
|
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 | | - |
1843 | 1800 | @Override |
1844 | 1801 | public KnnVectorsFormat getVectorsFormat(ElementType elementType) { |
1845 | 1802 | assert elementType == ElementType.FLOAT; |
@@ -1912,16 +1869,6 @@ static class Int4FlatIndexOptions extends QuantizedIndexOptions { |
1912 | 1869 | this.confidenceInterval = confidenceInterval == null ? 0f : confidenceInterval; |
1913 | 1870 | } |
1914 | 1871 |
|
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 | | - |
1925 | 1872 | @Override |
1926 | 1873 | public KnnVectorsFormat getVectorsFormat(ElementType elementType) { |
1927 | 1874 | assert elementType == ElementType.FLOAT; |
@@ -1981,18 +1928,6 @@ public Int8HnswIndexOptions(int m, int efConstruction, Float confidenceInterval, |
1981 | 1928 | this.confidenceInterval = confidenceInterval; |
1982 | 1929 | } |
1983 | 1930 |
|
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 | | - |
1996 | 1931 | @Override |
1997 | 1932 | public KnnVectorsFormat getVectorsFormat(ElementType elementType) { |
1998 | 1933 | assert elementType == ElementType.FLOAT; |
@@ -2074,17 +2009,6 @@ static class HnswIndexOptions extends DenseVectorIndexOptions { |
2074 | 2009 | this.efConstruction = efConstruction; |
2075 | 2010 | } |
2076 | 2011 |
|
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 | | - |
2088 | 2012 | @Override |
2089 | 2013 | public KnnVectorsFormat getVectorsFormat(ElementType elementType) { |
2090 | 2014 | if (elementType == ElementType.BIT) { |
@@ -2145,17 +2069,6 @@ public BBQHnswIndexOptions(int m, int efConstruction, RescoreVector rescoreVecto |
2145 | 2069 | this.efConstruction = efConstruction; |
2146 | 2070 | } |
2147 | 2071 |
|
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 | | - |
2159 | 2072 | @Override |
2160 | 2073 | KnnVectorsFormat getVectorsFormat(ElementType elementType) { |
2161 | 2074 | assert elementType == ElementType.FLOAT; |
@@ -2210,15 +2123,6 @@ static class BBQFlatIndexOptions extends QuantizedIndexOptions { |
2210 | 2123 | super(VectorIndexType.BBQ_FLAT, rescoreVector); |
2211 | 2124 | } |
2212 | 2125 |
|
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 | | - |
2222 | 2126 | @Override |
2223 | 2127 | KnnVectorsFormat getVectorsFormat(ElementType elementType) { |
2224 | 2128 | assert elementType == ElementType.FLOAT; |
@@ -2274,17 +2178,6 @@ static class BBQIVFIndexOptions extends QuantizedIndexOptions { |
2274 | 2178 | this.defaultNProbe = defaultNProbe; |
2275 | 2179 | } |
2276 | 2180 |
|
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 | | - |
2288 | 2181 | @Override |
2289 | 2182 | KnnVectorsFormat getVectorsFormat(ElementType elementType) { |
2290 | 2183 | assert elementType == ElementType.FLOAT; |
@@ -2323,14 +2216,10 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws |
2323 | 2216 | } |
2324 | 2217 | } |
2325 | 2218 |
|
2326 | | - public record RescoreVector(float oversample) implements ToXContentObject, Writeable { |
| 2219 | + public record RescoreVector(float oversample) implements ToXContentObject { |
2327 | 2220 | static final String NAME = "rescore_vector"; |
2328 | 2221 | static final String OVERSAMPLE = "oversample"; |
2329 | 2222 |
|
2330 | | - RescoreVector(StreamInput in) throws IOException { |
2331 | | - this(in.readFloat()); |
2332 | | - } |
2333 | | - |
2334 | 2223 | static RescoreVector fromIndexOptions(Map<String, ?> indexOptionsMap, IndexVersion indexVersion) { |
2335 | 2224 | Object rescoreVectorNode = indexOptionsMap.remove(NAME); |
2336 | 2225 | if (rescoreVectorNode == null) { |
@@ -2360,11 +2249,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws |
2360 | 2249 | builder.endObject(); |
2361 | 2250 | return builder; |
2362 | 2251 | } |
2363 | | - |
2364 | | - @Override |
2365 | | - public void writeTo(StreamOutput out) throws IOException { |
2366 | | - out.writeFloat(oversample); |
2367 | | - } |
2368 | 2252 | } |
2369 | 2253 |
|
2370 | 2254 | public static final TypeParser PARSER = new TypeParser( |
|
0 commit comments