SyliusElasticsearchPlugin
SyliusElasticsearchPlugin copied to clipboard
Attribute with boolean value is incorrectly queried as .keyword
I have a bunch of attributes in my project that are checkboxes (have boolean value) and trying to filter by them returns no results.
After debugging the problem I've noticed that the elastic query uses .keyword, but that is not correct for boolean fields as far as I know (it is correct for the string-values attributes)
In terms of elastic queries: this plugin uses the following:
"should": [
{
"term": {
"attribute_e89.keyword": {
"value": "1"
}
}
}
]
but this does not work. It should be doing the following (for boolean values):
"should": [
{
"term": {
"attribute_e89": {
"value": true
}
}
}
]
This is because the boolean attribute translates to boolean value in elastica:
{
"_index" : "shop_products_dev",
"_type" : "default",
"_id" : "2630",
"_score" : 0.031748697,
"_source" : {
"enabled" : true,
"name_nl_nl" : "Lightning-USB Adapter voor iPhone",
"attribute_e84" : [
true
],
"attribute_e89" : [
true
],
...
Hi, this issue is on same place of code https://github.com/BitBagCommerce/SyliusElasticsearchPlugin/issues/35
Looks like issue was fixed already, print screen with boolean attribute and correct search result below.
