Skip to content

Make indices APIs consistent #4071

@clintongormley

Description

@clintongormley

An index accepts settings, mappings, warmers and aliases. However, some use singular and some use plural, eg:

Mappings:

PUT /index/type/_mapping
{ type: { .... }}

GET /index/{type|*|blank}/_mapping

Settings:

PUT /index/_settings
GET /index/_settings

Warmers:

PUT /index/_warmer/name
{ ... }
GET /index/_warmer/{name|*|blank}

Aliases:

POST /_aliases
{ actions: [....] }

 PUT /index/_alias/alias
 { ... }

 GET /{index|*|_all}/_alias/{alias|*}

There are a couple of possibilities:

Distinguish between singular and plural when PUT/POSTing

Create/update a mapping, warmer or alias (not settings) with:

PUT /index/_mapping|_alias|_warmer/{name}
{ ... }

This breaks bwc for mapping (/index/type/_mapping vs /index/_mapping/type) - possibly support both variants for all actions?

Create/update mappings, warmers, aliases, settings with:

POST /index/_mappings|_settings|_warmers|_aliases
{ name: {....}, name2: {....} ... }

Retrieve via singular or plural:

GET /index/_mapping|_alias|_warmer|_setting/{name|*|_all|blank}
GET /index/_mappings|_aliases|_warmers|_settings/{name|*|_all|blank}

Alternatively, make singular/plural synonyms, so either can be used in any of the above examples

One final thing, all indices can be specified as _all or * (depending on the API), but eg warmers and aliases only understand wildcards. I think _all should be an acceptable alias for *for all of them

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions