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

Handle Elasticseach v6 enforcement of boolean values to query boolean attributes #655

Closed
andygout opened this issue Aug 14, 2018 · 1 comment
Labels

Comments

@andygout
Copy link

andygout commented Aug 14, 2018

N.B. We are using Elasticsearch in the context of the AWS Elasticsearch Service.

Elasticsearch v5 allowed boolean attributes to be queried with '1' and '0' to represent true and false booleans respectively.

Elasticsearch v6 does not, instead insisting upon boolean attributes to be queried with boolean values only.

Proposed fix #1:

The ES query response for boolean values will look like:
{ key: 1, key_as_string: 'true' } or { key: 0, key_as_string: 'false' }

Amend FacetAccessor.prototype.getBuckets so that where item.key_as_string exists, its value is assigned to item.key.

This would require this line to be changed from:
item.key = String(item.key)
to
item.key = item.key_as_string || String(item.key);

Proposed fix #2:

Amend MenuFilter.prototype.toggleFilter so that the value that is converted from '1' or '0' to true or false respectively before being set in this line.

This logic would also need to ascertain if the attributes being dealt with were intended as booleans, so as not to unintentionally convert numerical values to booleans.

@stale
Copy link

stale bot commented Dec 28, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 28, 2019
@stale stale bot closed this as completed Jan 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant