From dbe67695256592b266fdd158073f4236a83f1949 Mon Sep 17 00:00:00 2001 From: Adrien Grand Date: Wed, 4 Mar 2020 09:16:37 +0100 Subject: [PATCH] Remove `constant_keyword` from the info API. (#53071) I discussed with @rjernst about what kind of functionality should be reported in the info API, since it doesn't sound sensible to list every single feature there. As a guideline, Ryan suggested that functionality that needs to maintain state should definitely be in the info API, but probably not field mappers like `constant_keyword`. --- docs/reference/rest-api/info.asciidoc | 4 -- .../elasticsearch/xpack/core/XPackField.java | 2 - .../core/action/XPackInfoFeatureAction.java | 3 +- .../ConstantKeywordInfoTransportAction.java | 44 ------------------- .../ConstantKeywordMapperPlugin.java | 13 +----- 5 files changed, 2 insertions(+), 64 deletions(-) delete mode 100644 x-pack/plugin/mapper-constant-keyword/src/main/java/org/elasticsearch/xpack/constantkeyword/ConstantKeywordInfoTransportAction.java diff --git a/docs/reference/rest-api/info.asciidoc b/docs/reference/rest-api/info.asciidoc index 441dc8f3478a5..044ca958450d3 100644 --- a/docs/reference/rest-api/info.asciidoc +++ b/docs/reference/rest-api/info.asciidoc @@ -71,10 +71,6 @@ Example response: "available" : true, "enabled" : true }, - "constant_keyword" : { - "available" : true, - "enabled" : true - }, "enrich" : { "available" : true, "enabled" : true 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 c18cd6cb2850d..f2c682bd8a21b 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 @@ -55,8 +55,6 @@ public final class XPackField { public static final String ANALYTICS = "analytics"; /** Name constant for the enrich plugin. */ public static final String ENRICH = "enrich"; - /** Name constant for the constant-keyword plugin. */ - public static final String CONSTANT_KEYWORD = "constant_keyword"; private XPackField() {} 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 9dac2212534b1..c900f353d55d1 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 @@ -42,11 +42,10 @@ public class XPackInfoFeatureAction extends ActionType public static final XPackInfoFeatureAction SPATIAL = new XPackInfoFeatureAction(XPackField.SPATIAL); public static final XPackInfoFeatureAction ANALYTICS = new XPackInfoFeatureAction(XPackField.ANALYTICS); public static final XPackInfoFeatureAction ENRICH = new XPackInfoFeatureAction(XPackField.ENRICH); - public static final XPackInfoFeatureAction CONSTANT_KEYWORD = new XPackInfoFeatureAction(XPackField.CONSTANT_KEYWORD); public static final List ALL = Arrays.asList( SECURITY, MONITORING, WATCHER, GRAPH, MACHINE_LEARNING, LOGSTASH, EQL, SQL, ROLLUP, INDEX_LIFECYCLE, SNAPSHOT_LIFECYCLE, CCR, - TRANSFORM, FLATTENED, VECTORS, VOTING_ONLY, FROZEN_INDICES, SPATIAL, ANALYTICS, ENRICH, CONSTANT_KEYWORD + TRANSFORM, FLATTENED, VECTORS, VOTING_ONLY, FROZEN_INDICES, SPATIAL, ANALYTICS, ENRICH ); private XPackInfoFeatureAction(String name) { diff --git a/x-pack/plugin/mapper-constant-keyword/src/main/java/org/elasticsearch/xpack/constantkeyword/ConstantKeywordInfoTransportAction.java b/x-pack/plugin/mapper-constant-keyword/src/main/java/org/elasticsearch/xpack/constantkeyword/ConstantKeywordInfoTransportAction.java deleted file mode 100644 index 621138d1e0230..0000000000000 --- a/x-pack/plugin/mapper-constant-keyword/src/main/java/org/elasticsearch/xpack/constantkeyword/ConstantKeywordInfoTransportAction.java +++ /dev/null @@ -1,44 +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; - * you may not use this file except in compliance with the Elastic License. - */ - -package org.elasticsearch.xpack.constantkeyword; - -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.license.XPackLicenseState; -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 ConstantKeywordInfoTransportAction extends XPackInfoFeatureTransportAction { - - private final XPackLicenseState licenseState; - - @Inject - public ConstantKeywordInfoTransportAction(TransportService transportService, ActionFilters actionFilters, - Settings settings, XPackLicenseState licenseState) { - super(XPackInfoFeatureAction.CONSTANT_KEYWORD.name(), transportService, actionFilters); - this.licenseState = licenseState; - } - - @Override - public String name() { - return XPackField.CONSTANT_KEYWORD; - } - - @Override - public boolean available() { - return licenseState.isConstantKeywordAllowed(); - } - - @Override - public boolean enabled() { - return true; - } - -} diff --git a/x-pack/plugin/mapper-constant-keyword/src/main/java/org/elasticsearch/xpack/constantkeyword/ConstantKeywordMapperPlugin.java b/x-pack/plugin/mapper-constant-keyword/src/main/java/org/elasticsearch/xpack/constantkeyword/ConstantKeywordMapperPlugin.java index b129d3074dc31..daf378c78b837 100644 --- a/x-pack/plugin/mapper-constant-keyword/src/main/java/org/elasticsearch/xpack/constantkeyword/ConstantKeywordMapperPlugin.java +++ b/x-pack/plugin/mapper-constant-keyword/src/main/java/org/elasticsearch/xpack/constantkeyword/ConstantKeywordMapperPlugin.java @@ -6,23 +6,17 @@ package org.elasticsearch.xpack.constantkeyword; -import org.elasticsearch.action.ActionRequest; -import org.elasticsearch.action.ActionResponse; import org.elasticsearch.common.settings.Settings; 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.constantkeyword.mapper.ConstantKeywordFieldMapper; -import org.elasticsearch.xpack.core.action.XPackInfoFeatureAction; -import java.util.Arrays; -import java.util.List; import java.util.Map; import static java.util.Collections.singletonMap; -public class ConstantKeywordMapperPlugin extends Plugin implements MapperPlugin, ActionPlugin { +public class ConstantKeywordMapperPlugin extends Plugin implements MapperPlugin { public ConstantKeywordMapperPlugin(Settings settings) {} @@ -31,9 +25,4 @@ public Map getMappers() { return singletonMap(ConstantKeywordFieldMapper.CONTENT_TYPE, new ConstantKeywordFieldMapper.TypeParser()); } - @Override - public List> getActions() { - return Arrays.asList( - new ActionHandler<>(XPackInfoFeatureAction.CONSTANT_KEYWORD, ConstantKeywordInfoTransportAction.class)); - } }