Browse Source

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`.
Adrien Grand 5 years ago
parent
commit
dbe6769525

+ 0 - 4
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

+ 0 - 2
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() {}
 

+ 1 - 2
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/XPackInfoFeatureAction.java

@@ -42,11 +42,10 @@ public class XPackInfoFeatureAction extends ActionType<XPackInfoFeatureResponse>
     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<XPackInfoFeatureAction> 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) {

+ 0 - 44
x-pack/plugin/mapper-constant-keyword/src/main/java/org/elasticsearch/xpack/constantkeyword/ConstantKeywordInfoTransportAction.java

@@ -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;
-    }
-
-}

+ 1 - 12
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 class ConstantKeywordMapperPlugin extends Plugin implements MapperPlugin,
         return singletonMap(ConstantKeywordFieldMapper.CONTENT_TYPE, new ConstantKeywordFieldMapper.TypeParser());
     }
 
-    @Override
-    public List<ActionHandler<? extends ActionRequest, ? extends ActionResponse>> getActions() {
-        return Arrays.asList(
-            new ActionHandler<>(XPackInfoFeatureAction.CONSTANT_KEYWORD, ConstantKeywordInfoTransportAction.class));
-    }
 }