Skip to content

[7.x] Make isHidden a primitive when finding v2 templates (#55408)#55433

Merged
andreidan merged 1 commit intoelastic:7.xfrom
andreidan:backport/7x-itv2-ishidden-primitive
Apr 20, 2020
Merged

[7.x] Make isHidden a primitive when finding v2 templates (#55408)#55433
andreidan merged 1 commit intoelastic:7.xfrom
andreidan:backport/7x-itv2-ishidden-primitive

Conversation

@andreidan
Copy link
Copy Markdown
Contributor

isHidden was a Boolean in order to treat a special case identified
with V1 templates where if the create index request didn't specify if
the index should be hidden or not (ie. isHidden was null) but the
index matched a template that specified the index.hidden setting we
needed to remove the global templates from the templates we'll apply to
the new index (note: this is important with V1 templates as inheritance
is supported).

With V2 templates we match only one template with an index so the
equivalent check did not need to exist (we added a sanity check in
#55015 where we make sure
we don't apply an invalid global template - one that specifes the
index.hidden setting, but this is a check we make irrespective of the
user specifying or not if the index should be hidden)

This commit makes isHidden when matching V2 templates a boolean
primitive, eliminating the need for the null state to exist. Note that
some methods which use the matching V2 templates still work with a
Boolean object isHidden attribute as they are also matching the V1
templates. These methods will pass in false instead of null when
finding the V2 templates.

(cherry picked from commit c5b923a)
Signed-off-by: Andrei Dan andrei.dan@elastic.co

Backport of #55408

isHidden was a `Boolean` in order to treat a special case identified
with V1 templates where if the create index request didn't specify if
the index should be hidden or not (ie. isHidden was `null`) but the
index matched a template that specified the `index.hidden` setting we
needed to remove the global templates from the templates we'll apply to
the new index (note: this is important with V1 templates as inheritance
is supported).

With V2 templates we match only one template with an index so the
equivalent check did not need to exist (we added a sanity check in
elastic#55015 where we make sure
we don't apply an invalid global template - one that specifes the
`index.hidden` setting, but this is a check we make irrespective of the
user specifying or not if the index should be hidden)

This commit makes `isHidden` when matching V2 templates a boolean
primitive, eliminating the need for the `null` state to exist. Note that
some methods which use the matching V2 templates still work with a
`Boolean` object `isHidden` attribute as they are also matching the V1
templates. These methods will pass in `false` instead of `null` when
finding the V2 templates.

(cherry picked from commit c5b923a)
Signed-off-by: Andrei Dan <andrei.dan@elastic.co>
@andreidan andreidan added :Data Management/Indices APIs DO NOT USE. Use ":Distributed/Indices APIs" or ":StorageEngine/Templates" instead. backport v7.8.0 labels Apr 19, 2020
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-core-features (:Core/Features/Indices APIs)

@andreidan andreidan changed the title Make isHidden a primitive when finding v2 templates (#55408) [7.x] Make isHidden a primitive when finding v2 templates (#55408) Apr 19, 2020
@andreidan andreidan merged commit e98b68b into elastic:7.x Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport :Data Management/Indices APIs DO NOT USE. Use ":Distributed/Indices APIs" or ":StorageEngine/Templates" instead. v7.8.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants