I’m working on a Magento 2.3.6 site which Catalog / Search Engine setup for ElasticSearch Suite 1.9.
The products’ visibility are setup this way:
Simple products: Search
Configurable products: Search, Catalog
On the frontend when selecting a filter, eg a colour, the results are not showing simple products which matches the filter. It will only display configurable ones.
I don’t want the simple products to show in the catalog, but the only way ElasticSearch Suite filter bar will display the variations will be if their visibility is set to Catalog or “Catalog, Search”.
While debugging the elasticsearch query, I can see that somehow visibility is being set twice
{"size":24,"sort":[{"cf_new":{"order":"desc","missing":"_first","unmapped_type":"keyword"}},{"name.sortable":{"order":"ASC","missing":"_first","unmapped_type":"keyword"}},{"_score":{"order":"asc"}},{"entity_id":{"order":"asc","missing":"_last","unmapped_type":"keyword"}}],"from":0,"query":{"constant_score":{"filter":{"bool":{"must":[{"nested":{"path":"category","score_mode":"none","query":{"bool":{"must":[{"bool":{"must_not":[{"term":{"category.is_virtual":{"value":true,"boost":1}}}],"boost":1}},{"terms":{"category.category_id":["3"],"boost":1}}],"must_not":[],"should":[],"boost":1}},"boost":1}},{"term":{"stock.is_in_stock":{"value":true,"boost":1}}},{"terms":{"visibility":[2,4],"boost":1}},{"bool":{"must_not":[{"nested":{"path":"category","score_mode":"none","query":{"bool":{"must":[{"term":{"category.category_id":{"value":3,"boost":1}}},{"term":{"category.is_blacklisted":{"value":true,"boost":1}}}],"must_not":[],"should":[],"boost":1}},"boost":1}}],"boost":1}},{"terms":{"visibility":[3,4],"boost":1}}],"must_not":[],"should":[],"boost":1}},"boost":1}},"post_filter":{"terms":{"option_text_cf_colour.untouched":["Black"],"boost":1}},"aggregations":{"attribute_set_id":{"filter":{"terms":{"option_text_cf_colour.untouched":["Black"],"boost":1}},"aggregations":{"attribute_set_id":{"terms":{"field":"attribute_set_id","size":100000,"order":{"_count":"desc"}}}}},"categories":{"filter":{"terms":{"option_text_cf_colour.untouched":["Black"],"boost":1}},"aggregations":{"categories":{"filters":{"filters":{"9":{"nested":{"path":"category","score_mode":"none","query":{"bool":{"must":[{"bool":{"must_not":[{"term":{"category.is_virtual":{"value":true,"boost":1}}}],"boost":1}},{"terms":{"category.category_id":["9"],"boost":1}}],"must_not":[],"should":[],"boost":1}},"boost":1}},"10":{"nested":{"path":"category","score_mode":"none","query":{"bool":{"must":[{"bool":{"must_not":[{"term":{"category.is_virtual":{"value":true,"boost":1}}}],"boost":1}},{"terms":{"category.category_id":["10"],"boost":1}}],"must_not":[],"should":[],"boost":1}},"boost":1}},"30":{"nested":{"path":"category","score_mode":"none","query":{"bool":{"must":[{"bool":{"must_not":[{"term":{"category.is_virtual":{"value":true,"boost":1}}}],"boost":1}},{"terms":{"category.category_id":["30"],"boost":1}}],"must_not":[],"should":[],"boost":1}},"boost":1}}}}}}},"option_text_cf_category":{"filter":{"terms":{"option_text_cf_colour.untouched":["Black"],"boost":1}},"aggregations":{"option_text_cf_category":{"terms":{"field":"option_text_cf_category.untouched","size":10,"order":{"_count":"desc"}}}}},"option_text_cf_search_cat":{"filter":{"terms":{"option_text_cf_colour.untouched":["Black"],"boost":1}},"aggregations":{"option_text_cf_search_cat":{"terms":{"field":"option_text_cf_search_cat.untouched","size":10,"order":{"_count":"desc"}}}}},"option_text_cf_materials_filter":{"filter":{"terms":{"option_text_cf_colour.untouched":["Black"],"boost":1}},"aggregations":{"option_text_cf_materials_filter":{"terms":{"field":"option_text_cf_materials_filter.untouched","size":10,"order":{"_count":"desc"}}}}},"option_text_cf_design":{"filter":{"terms":{"option_text_cf_colour.untouched":["Black"],"boost":1}},"aggregations":{"option_text_cf_design":{"terms":{"field":"option_text_cf_design.untouched","size":10,"order":{"_count":"desc"}}}}},"option_text_cf_technique_filter":{"filter":{"terms":{"option_text_cf_colour.untouched":["Black"],"boost":1}},"aggregations":{"option_text_cf_technique_filter":{"terms":{"field":"option_text_cf_technique_filter.untouched","size":10,"order":{"_count":"desc"}}}}},"option_text_cf_colour":{"terms":{"field":"option_text_cf_colour.untouched","size":100000,"order":{"_count":"desc"}}}},"track_total_hits":true}
Does anyone know why this could be happening? I’ve reindexed the DB so it’s not a problem with that. If I change a Simple product Visibility from Search to Catalog, that simple product it will start being displayed when filtering by any of the filterable attributes.