diff --git a/build.gradle b/build.gradle index 8350fddb1e59b..062389643ee9f 100644 --- a/build.gradle +++ b/build.gradle @@ -144,9 +144,9 @@ tasks.register("verifyVersions") { * after the backport of the backcompat code is complete. */ -boolean bwc_tests_enabled = true +boolean bwc_tests_enabled = false // place a PR link here when committing bwc changes: -String bwc_tests_disabled_issue = "" +String bwc_tests_disabled_issue = "https://github.com/elastic/elasticsearch/pull/75017" /* * FIPS 140-2 behavior was fixed in 7.11.0. Before that there is no way to run elasticsearch in a * JVM that is properly configured to be in fips mode with BCFIPS. For now we need to disable diff --git a/docs/reference/rest-api/info.asciidoc b/docs/reference/rest-api/info.asciidoc index 3ab37721128d9..6884dca24499a 100644 --- a/docs/reference/rest-api/info.asciidoc +++ b/docs/reference/rest-api/info.asciidoc @@ -142,10 +142,6 @@ Example response: "available" : true, "enabled" : true }, - "vectors" : { - "available" : true, - "enabled" : true - }, "voting_only" : { "available" : true, "enabled" : true diff --git a/docs/reference/rest-api/usage.asciidoc b/docs/reference/rest-api/usage.asciidoc index 1f98b2ffa0c95..6ce1725a49c1e 100644 --- a/docs/reference/rest-api/usage.asciidoc +++ b/docs/reference/rest-api/usage.asciidoc @@ -272,12 +272,6 @@ GET /_xpack/usage "available" : true, "enabled" : true }, - "vectors" : { - "available" : true, - "enabled" : true, - "dense_vector_fields_count" : 0, - "dense_vector_dims_avg_count" : 0 - }, "voting_only" : { "available" : true, "enabled" : true diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackClientPlugin.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackClientPlugin.java index e03b929224455..e87aac26efc41 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackClientPlugin.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackClientPlugin.java @@ -218,7 +218,6 @@ import org.elasticsearch.xpack.core.transform.transforms.TimeSyncConfig; import org.elasticsearch.xpack.core.transform.transforms.TransformState; import org.elasticsearch.xpack.core.transform.transforms.TransformTaskParams; -import org.elasticsearch.xpack.core.vectors.VectorsFeatureSetUsage; import org.elasticsearch.xpack.core.votingonly.VotingOnlyNodeFeatureSetUsage; import org.elasticsearch.xpack.core.watcher.WatcherFeatureSetUsage; import org.elasticsearch.xpack.core.watcher.WatcherMetadata; @@ -516,8 +515,6 @@ public List getNamedWriteables() { TransformField.TIME.getPreferredName(), TimeRetentionPolicyConfig::new ), - // Vectors - new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.VECTORS, VectorsFeatureSetUsage::new), // Voting Only Node new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.VOTING_ONLY, VotingOnlyNodeFeatureSetUsage::new), // Frozen indices diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackField.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackField.java index cb665b4e8b1f4..59343705b9098 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackField.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackField.java @@ -48,6 +48,7 @@ public final class XPackField { */ @Deprecated public static final String FLATTENED = "flattened"; + @Deprecated /** Name constant for the vectors feature. */ public static final String VECTORS = "vectors"; /** Name constant for the voting-only-node feature. */ diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/XPackInfoFeatureAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/XPackInfoFeatureAction.java index d5b789498f27e..9f62ddc868de1 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/XPackInfoFeatureAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/XPackInfoFeatureAction.java @@ -38,7 +38,6 @@ public class XPackInfoFeatureAction extends ActionType public static final XPackInfoFeatureAction SNAPSHOT_LIFECYCLE = new XPackInfoFeatureAction(XPackField.SNAPSHOT_LIFECYCLE); public static final XPackInfoFeatureAction CCR = new XPackInfoFeatureAction(XPackField.CCR); public static final XPackInfoFeatureAction TRANSFORM = new XPackInfoFeatureAction(XPackField.TRANSFORM); - public static final XPackInfoFeatureAction VECTORS = new XPackInfoFeatureAction(XPackField.VECTORS); public static final XPackInfoFeatureAction VOTING_ONLY = new XPackInfoFeatureAction(XPackField.VOTING_ONLY); public static final XPackInfoFeatureAction FROZEN_INDICES = new XPackInfoFeatureAction(XPackField.FROZEN_INDICES); public static final XPackInfoFeatureAction SPATIAL = new XPackInfoFeatureAction(XPackField.SPATIAL); @@ -54,7 +53,7 @@ public class XPackInfoFeatureAction extends ActionType final List actions = new ArrayList<>(); actions.addAll(Arrays.asList( SECURITY, MONITORING, WATCHER, GRAPH, MACHINE_LEARNING, LOGSTASH, EQL, SQL, ROLLUP, INDEX_LIFECYCLE, SNAPSHOT_LIFECYCLE, CCR, - TRANSFORM, VECTORS, VOTING_ONLY, FROZEN_INDICES, SPATIAL, ANALYTICS, ENRICH, DATA_STREAMS, SEARCHABLE_SNAPSHOTS, DATA_TIERS, + TRANSFORM, VOTING_ONLY, FROZEN_INDICES, SPATIAL, ANALYTICS, ENRICH, DATA_STREAMS, SEARCHABLE_SNAPSHOTS, DATA_TIERS, AGGREGATE_METRIC )); ALL = Collections.unmodifiableList(actions); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/XPackUsageFeatureAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/XPackUsageFeatureAction.java index 9dc60904d452e..cd310064ffa0f 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/XPackUsageFeatureAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/XPackUsageFeatureAction.java @@ -35,7 +35,6 @@ public class XPackUsageFeatureAction extends ActionType { - - @Override - protected VectorsFeatureSetUsage createTestInstance() { - boolean available = randomBoolean(); - boolean enabled = randomBoolean(); - if (available && enabled) { - return new VectorsFeatureSetUsage(available, randomIntBetween(0, 100000), randomIntBetween(0, 1024)); - } else { - return new VectorsFeatureSetUsage(available, 0, 0); - } - } - - @Override - protected VectorsFeatureSetUsage mutateInstance(VectorsFeatureSetUsage instance) throws IOException { - boolean available = instance.available(); - boolean enabled = instance.enabled(); - int numDenseVectorFields = instance.numDenseVectorFields(); - int avgDenseVectorDims = instance.avgDenseVectorDims(); - - if (available == false || enabled == false) { - available = true; - enabled = true; - } - numDenseVectorFields = randomValueOtherThan(numDenseVectorFields, () -> randomIntBetween(0, 100000)); - avgDenseVectorDims = randomValueOtherThan(avgDenseVectorDims, () -> randomIntBetween(0, 1024)); - return new VectorsFeatureSetUsage(available, numDenseVectorFields, avgDenseVectorDims); - } - - @Override - protected Writeable.Reader instanceReader() { - return VectorsFeatureSetUsage::new; - } - -} diff --git a/x-pack/plugin/security/qa/operator-privileges-tests/src/javaRestTest/java/org/elasticsearch/xpack/security/operator/Constants.java b/x-pack/plugin/security/qa/operator-privileges-tests/src/javaRestTest/java/org/elasticsearch/xpack/security/operator/Constants.java index 5fbdc43cdf00b..94cfa44f4e1af 100644 --- a/x-pack/plugin/security/qa/operator-privileges-tests/src/javaRestTest/java/org/elasticsearch/xpack/security/operator/Constants.java +++ b/x-pack/plugin/security/qa/operator-privileges-tests/src/javaRestTest/java/org/elasticsearch/xpack/security/operator/Constants.java @@ -277,7 +277,6 @@ public class Constants { "cluster:monitor/xpack/info/spatial", "cluster:monitor/xpack/info/sql", "cluster:monitor/xpack/info/transform", - "cluster:monitor/xpack/info/vectors", "cluster:monitor/xpack/info/voting_only", "cluster:monitor/xpack/info/watcher", "cluster:monitor/xpack/license/get", @@ -331,7 +330,6 @@ public class Constants { "cluster:monitor/xpack/usage/spatial", "cluster:monitor/xpack/usage/sql", "cluster:monitor/xpack/usage/transform", - "cluster:monitor/xpack/usage/vectors", "cluster:monitor/xpack/usage/voting_only", "cluster:monitor/xpack/usage/watcher", "cluster:monitor/xpack/watcher/stats/dist", diff --git a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/vectors/50_vector_stats.yml b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/vectors/50_vector_stats.yml deleted file mode 100644 index 9ca60475fc887..0000000000000 --- a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/vectors/50_vector_stats.yml +++ /dev/null @@ -1,42 +0,0 @@ -setup: - - skip: - features: headers - version: " - 7.3.99" - reason: "vector stats was added from 7.4" - ---- -"Usage stats on vector fields": - - do: {xpack.usage: {}} - - match: { vectors.available: true } - - match: { vectors.enabled: true } - - match: { vectors.dense_vector_fields_count: 0 } - - match: { vectors.dense_vector_dims_avg_count: 0 } - - - do: - indices.create: - index: test-index1 - body: - mappings: - properties: - my_dense_vector1: - type: dense_vector - dims: 10 - my_dense_vector2: - type: dense_vector - dims: 30 - - - do: - indices.create: - index: test-index2 - body: - mappings: - properties: - my_dense_vector3: - type: dense_vector - dims: 20 - - - do: {xpack.usage: {}} - - match: { vectors.available: true } - - match: { vectors.enabled: true } - - match: { vectors.dense_vector_fields_count: 3 } - - match: { vectors.dense_vector_dims_avg_count: 20 } diff --git a/x-pack/plugin/vectors/src/main/java/org/elasticsearch/xpack/vectors/Vectors.java b/x-pack/plugin/vectors/src/main/java/org/elasticsearch/xpack/vectors/Vectors.java index abf3346f4af3d..d5d9a2d9ca201 100644 --- a/x-pack/plugin/vectors/src/main/java/org/elasticsearch/xpack/vectors/Vectors.java +++ b/x-pack/plugin/vectors/src/main/java/org/elasticsearch/xpack/vectors/Vectors.java @@ -7,34 +7,20 @@ package org.elasticsearch.xpack.vectors; -import org.elasticsearch.action.ActionRequest; -import org.elasticsearch.action.ActionResponse; import org.elasticsearch.index.mapper.Mapper; -import org.elasticsearch.plugins.ActionPlugin; import org.elasticsearch.plugins.MapperPlugin; import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.xpack.core.action.XPackInfoFeatureAction; -import org.elasticsearch.xpack.core.action.XPackUsageFeatureAction; import org.elasticsearch.xpack.vectors.mapper.DenseVectorFieldMapper; import org.elasticsearch.xpack.vectors.mapper.SparseVectorFieldMapper; -import java.util.Arrays; import java.util.Collections; import java.util.LinkedHashMap; -import java.util.List; import java.util.Map; -public class Vectors extends Plugin implements MapperPlugin, ActionPlugin { +public class Vectors extends Plugin implements MapperPlugin { public Vectors() { } - @Override - public List> getActions() { - return Arrays.asList( - new ActionPlugin.ActionHandler<>(XPackUsageFeatureAction.VECTORS, VectorsUsageTransportAction.class), - new ActionPlugin.ActionHandler<>(XPackInfoFeatureAction.VECTORS, VectorsInfoTransportAction.class)); - } - @Override public Map getMappers() { Map mappers = new LinkedHashMap<>(); diff --git a/x-pack/plugin/vectors/src/main/java/org/elasticsearch/xpack/vectors/VectorsInfoTransportAction.java b/x-pack/plugin/vectors/src/main/java/org/elasticsearch/xpack/vectors/VectorsInfoTransportAction.java deleted file mode 100644 index 37c69bf4f652a..0000000000000 --- a/x-pack/plugin/vectors/src/main/java/org/elasticsearch/xpack/vectors/VectorsInfoTransportAction.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -package org.elasticsearch.xpack.vectors; - -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.transport.TransportService; -import org.elasticsearch.xpack.core.XPackField; -import org.elasticsearch.xpack.core.action.XPackInfoFeatureAction; -import org.elasticsearch.xpack.core.action.XPackInfoFeatureTransportAction; - -public class VectorsInfoTransportAction extends XPackInfoFeatureTransportAction { - - @Inject - public VectorsInfoTransportAction(TransportService transportService, ActionFilters actionFilters) { - super(XPackInfoFeatureAction.VECTORS.name(), transportService, actionFilters); - } - - @Override - public String name() { - return XPackField.VECTORS; - } - - @Override - public boolean available() { - return true; - } - - @Override - public boolean enabled() { - return true; - } - -} diff --git a/x-pack/plugin/vectors/src/main/java/org/elasticsearch/xpack/vectors/VectorsUsageTransportAction.java b/x-pack/plugin/vectors/src/main/java/org/elasticsearch/xpack/vectors/VectorsUsageTransportAction.java deleted file mode 100644 index bf55052b1196c..0000000000000 --- a/x-pack/plugin/vectors/src/main/java/org/elasticsearch/xpack/vectors/VectorsUsageTransportAction.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -package org.elasticsearch.xpack.vectors; - -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.metadata.IndexMetadata; -import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.metadata.MappingMetadata; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.protocol.xpack.XPackUsageRequest; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.TransportService; -import org.elasticsearch.xpack.core.action.XPackUsageFeatureAction; -import org.elasticsearch.xpack.core.action.XPackUsageFeatureResponse; -import org.elasticsearch.xpack.core.action.XPackUsageFeatureTransportAction; -import org.elasticsearch.xpack.core.vectors.VectorsFeatureSetUsage; -import org.elasticsearch.xpack.vectors.mapper.DenseVectorFieldMapper; -import org.elasticsearch.xpack.vectors.mapper.SparseVectorFieldMapper; - -import java.util.Map; - -public class VectorsUsageTransportAction extends XPackUsageFeatureTransportAction { - - @Inject - public VectorsUsageTransportAction(TransportService transportService, ClusterService clusterService, ThreadPool threadPool, - ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) { - super(XPackUsageFeatureAction.VECTORS.name(), transportService, clusterService, - threadPool, actionFilters, indexNameExpressionResolver); - } - - @Override - protected void masterOperation(Task task, XPackUsageRequest request, ClusterState state, - ActionListener listener) { - int numDenseVectorFields = 0; - int numSparseVectorFields = 0; - int avgDenseVectorDims = 0; - - if (state != null) { - for (IndexMetadata indexMetadata : state.metadata()) { - MappingMetadata mappingMetadata = indexMetadata.mapping(); - if (mappingMetadata != null) { - Map mappings = mappingMetadata.getSourceAsMap(); - if (mappings.containsKey("properties")) { - @SuppressWarnings("unchecked") Map> fieldMappings = - (Map>) mappings.get("properties"); - for (Map typeDefinition : fieldMappings.values()) { - String fieldType = (String) typeDefinition.get("type"); - if (fieldType != null) { - if (fieldType.equals(DenseVectorFieldMapper.CONTENT_TYPE)) { - numDenseVectorFields++; - int dims = (Integer) typeDefinition.get("dims"); - avgDenseVectorDims += dims; - } else if (fieldType.equals(SparseVectorFieldMapper.CONTENT_TYPE)) { - numSparseVectorFields++; - } - } - } - } - } - } - if (numDenseVectorFields > 0) { - avgDenseVectorDims = avgDenseVectorDims / numDenseVectorFields; - } - } - VectorsFeatureSetUsage usage = - new VectorsFeatureSetUsage(true, numDenseVectorFields, avgDenseVectorDims); - listener.onResponse(new XPackUsageFeatureResponse(usage)); - } -} diff --git a/x-pack/plugin/vectors/src/test/java/org/elasticsearch/xpack/vectors/VectorsInfoTransportActionTests.java b/x-pack/plugin/vectors/src/test/java/org/elasticsearch/xpack/vectors/VectorsInfoTransportActionTests.java deleted file mode 100644 index 4286338b29abc..0000000000000 --- a/x-pack/plugin/vectors/src/test/java/org/elasticsearch/xpack/vectors/VectorsInfoTransportActionTests.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -package org.elasticsearch.xpack.vectors; - -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.PlainActionFuture; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.transport.TransportService; -import org.elasticsearch.xpack.core.XPackFeatureSet; -import org.elasticsearch.xpack.core.action.XPackUsageFeatureResponse; -import org.elasticsearch.xpack.core.vectors.VectorsFeatureSetUsage; - -import static org.hamcrest.core.Is.is; -import static org.mockito.Mockito.mock; - -public class VectorsInfoTransportActionTests extends ESTestCase { - - public void testAvailable() throws Exception { - VectorsInfoTransportAction featureSet = new VectorsInfoTransportAction( - mock(TransportService.class), mock(ActionFilters.class)); - assertThat(featureSet.available(), is(true)); - - var usageAction = new VectorsUsageTransportAction(mock(TransportService.class), null, null, - mock(ActionFilters.class), null); - PlainActionFuture future = new PlainActionFuture<>(); - usageAction.masterOperation(null, null, null, future); - XPackFeatureSet.Usage usage = future.get().getUsage(); - assertThat(usage.available(), is(true)); - - BytesStreamOutput out = new BytesStreamOutput(); - usage.writeTo(out); - XPackFeatureSet.Usage serializedUsage = new VectorsFeatureSetUsage(out.bytes().streamInput()); - assertThat(serializedUsage.available(), is(true)); - } - - public void testAlwaysEnabled() throws Exception { - VectorsInfoTransportAction featureSet = new VectorsInfoTransportAction( -mock(TransportService.class), mock(ActionFilters.class)); - assertThat(featureSet.enabled(), is(true)); - - VectorsUsageTransportAction usageAction = new VectorsUsageTransportAction(mock(TransportService.class), - null, null, mock(ActionFilters.class), null); - PlainActionFuture future = new PlainActionFuture<>(); - usageAction.masterOperation(null, null, null, future); - XPackFeatureSet.Usage usage = future.get().getUsage(); - assertThat(usage.enabled(), is(true)); - - BytesStreamOutput out = new BytesStreamOutput(); - usage.writeTo(out); - XPackFeatureSet.Usage serializedUsage = new VectorsFeatureSetUsage(out.bytes().streamInput()); - assertThat(serializedUsage.enabled(), is(true)); - } - -}