Skip to content

Discuss split/removal of the Id type #4385

@flobernd

Description

@flobernd

🚀 Feature Proposal

Discuss about splitting/removing the generic Id type.

Proposal:

Always use the concrete type (mainly string or integer) instead of Id, except for cases where the types might carry special semantics in certain language clients (e.g. .NET has custom implementations for Id [which should really only apply to document ids], NodeId` and some others).

Motivation

The generic Id type often causes problems (latest one #4384) and is confusing for new contributors.

In the current state, Id is some opaque type used for all kind of different ids all over the place. This ranges from document ids, shard ids, user ids, etc. etc.

This is problematic since Id is limited to string ids by definition:

export type Id = string

This causes issues, when Id is actually used for e.g. numeric ids like in the shard_id case mentioned above (#4384). Not using Id in some specific cases, but using it in most other places is inconsistent.

Further:

For some ids, we use specific types like e.g. NodeId, which is as well just an alias for string.

^ This design is driven by some statically typed clients like .NET where some of the types have custom implementations that do carry special semantics.

cc @elastic/devtools-team @swallez @Anaethelion @pquentin @l-trotta

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