Skip to content
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

Serialize DynamicMapping values as booleans instead of string #139

Closed
henricm opened this issue Jan 26, 2022 · 2 comments · Fixed by #275
Closed

Serialize DynamicMapping values as booleans instead of string #139

henricm opened this issue Jan 26, 2022 · 2 comments · Fixed by #275
Labels
Category: Bug Something isn't working
Milestone

Comments

@henricm
Copy link

henricm commented Jan 26, 2022

Seems like Kibana has problems displaying index templates created with dynamic mappings set to DynamicMapping.False. Please see issue:
elastic/kibana#123809

I guess Kibana should be able to handle this, but also, maybe DynamicMapping generate boolean values instead of string values?

@swallez
Copy link
Member

swallez commented Jan 26, 2022

Thanks for the report. There are a few places where Elasticsearch accepts either a boolean or a string constant, hence the use of an enumeration with True and False members that are sent as strings.

Elasticsearch is lenient and happily accepts a string for boolean values, so this is usually not an issue. In the particular case of templates however, they're stored and sent back "as is" when Kibana fetches the template definition.

The issue could be solved on either side (client library or Kibana), but I think that the client should send a JSON boolean, which is semantically more correct.

@swallez swallez added the Category: Bug Something isn't working label Jan 26, 2022
@swallez swallez added this to the v7.17.1 milestone Jan 26, 2022
@swallez
Copy link
Member

swallez commented Jan 31, 2022

Another manifestation of the same issue, but when dynamic: true is returned when getting the index template https://discuss.elastic.co/t/java-unexpected-json-event-value-true-instead-of-key-name-value-string/295740

ElenaStoeva added a commit to elastic/kibana that referenced this issue Feb 10, 2023
Fixes #123809

## Summary

This PR adds support for the `'true'`, `'false'`, and `'runtime'` values
for the `dynamic` field of index templates as they are [supported by
Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/reference/8.6/dynamic.html#dynamic-parameters).
Before these changes, setting one of these values for the `dynamic`
field would cause a `MultipleMappingsWarning` message when editing the
Mappings section as described in the scenario in
#123809.

Regarding the string values `'true'` and `'false'`, according to
elastic/elasticsearch-java#139, "Elasticsearch
is lenient and happily accepts a string for boolean values", which is
why we need to add support for these two values in Kibana.



https://user-images.githubusercontent.com/59341489/217516509-88679c38-271c-4c7d-9145-27c7f9cfa8ca.mov



### Checklist

- [X] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants