-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Make isHidden a primitive when finding v2 templates #55408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
andreidan
merged 2 commits into
elastic:master
from
andreidan:isHidden-boolean-primitive
Apr 19, 2020
Merged
Make isHidden a primitive when finding v2 templates #55408
andreidan
merged 2 commits into
elastic:master
from
andreidan:isHidden-boolean-primitive
Apr 19, 2020
Conversation
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
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.
Pinging @elastic/es-core-features (:Core/Features/Indices APIs) |
dakrone
approved these changes
Apr 17, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks Andrei!
@elasticmachine update branch |
andreidan
added a commit
to andreidan/elasticsearch
that referenced
this pull request
Apr 19, 2020
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 <[email protected]>
andreidan
added a commit
that referenced
this pull request
Apr 20, 2020
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 <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
:Data Management/Indices APIs
APIs to create and manage indices and templates
>non-issue
v7.8.0
v8.0.0-alpha1
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
Boolean
in 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.hidden
setting 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.hidden
setting, but this is a check we make irrespective of theuser specifying or not if the index should be hidden)
This commit makes
isHidden
when matching V2 templates a booleanprimitive, eliminating the need for the
null
state to exist. Note thatsome methods which use the matching V2 templates still work with a
Boolean
objectisHidden
attribute as they are also matching the V1templates. These methods will pass in
false
instead ofnull
whenfinding the V2 templates.