[7.x] Make isHidden a primitive when finding v2 templates (#55408)#55433
Merged
andreidan merged 1 commit intoelastic:7.xfrom Apr 20, 2020
Merged
Conversation
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>
Collaborator
|
Pinging @elastic/es-core-features (:Core/Features/Indices APIs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
isHidden was a
Booleanin order to treat a special case identifiedwith V1 templates where if the create index request didn't specify if
the index should be hidden or not (ie. isHidden was
null) but theindex matched a template that specified the
index.hiddensetting weneeded 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.hiddensetting, but this is a check we make irrespective of theuser specifying or not if the index should be hidden)
This commit makes
isHiddenwhen matching V2 templates a booleanprimitive, eliminating the need for the
nullstate to exist. Note thatsome methods which use the matching V2 templates still work with a
BooleanobjectisHiddenattribute as they are also matching the V1templates. These methods will pass in
falseinstead ofnullwhenfinding the V2 templates.
(cherry picked from commit c5b923a)
Signed-off-by: Andrei Dan andrei.dan@elastic.co
Backport of #55408