Skip to content

Refactor GET {index} vs GET {index}/_settings etc #16053

@clintongormley

Description

@clintongormley

Today the RestGetIndicesAction registers:

    controller.registerHandler(GET, "/{index}", this);
    controller.registerHandler(GET, "/{index}/{type}", this);

... where {type} is zero or more of _aliases, _mappings, _settings, _warmers (which should be removed)

But then we have RestGetFieldMappingAction which registers:

    controller.registerHandler(GET, "/_mapping/field/{fields}", this);
    controller.registerHandler(GET, "/_mapping/{type}/field/{fields}", this);
    controller.registerHandler(GET, "/{index}/_mapping/field/{fields}", this);
    controller.registerHandler(GET, "/{index}/{type}/_mapping/field/{fields}", this);
    controller.registerHandler(GET, "/{index}/_mapping/{type}/field/{fields}", this);

and RestGetSettingsAction which registers:

    controller.registerHandler(GET, "/{index}/_settings/{name}", this);
    controller.registerHandler(GET, "/_settings/{name}", this);
    controller.registerHandler(GET, "/{index}/_setting/{name}", this);

and the deprecated RestGetIndicesAliasesAction which registers:

    controller.registerHandler(GET, "/{index}/_aliases/{name}", this);
    controller.registerHandler(GET, "/_aliases/{name}", this);

This makes for some confusion eg you'd expect GET index/_settings to be handled by RestGetSettingsAction but actually you have to specify eg GET index/_settings/* in order to force that code path.

Can we refactor this to simplify the code?

  • RestGetIndicesAliasesAction is already deprecated.
  • I'm not sure that GET {index}/_settings/{name} really needs to be supported. I think we can get rid of it in master.
  • The GET index/type/_mapping order has been deprecated since 1.0 in favour of GET index/_mapping/type, which just leaves handling the GET _mapping/field structure

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions