Using text attributes with multiple values

Hi, we are using Magento with Algolia. As the attributevalues for the products are integrated from an external PIM system, it would be good to just use text attributes in Magento, so we do not have to created all the multiselect options first. How can those values in text attributes be structured, so that we can configure in Algolia to use them as multiselect attributes?


Attribute: Product Colors
Value for product: red|blue|green

In the case, the product is red, blue and green and each color should be used separately as a multiselect filter. To separate those values, any character would be possible like, $ or |

What is the best way to do it?


Hi @j.kuschezki_showcase! Thanks for posting your question. Can you tell us more about your implementation? Are you using the Algolia Magento 2 extension or a custom implementation?

For reference, in our extension, we index configurable attributes for configurable products as an array with their text value as you can see below:

It would be possible to for you to index similarly.

Hi Betty,

thanks for answering so quickly.

We are using Magento 2 and the Algolia Extension. Normally we would set up a multiselect attribute in Magento as as real “Multiselect” attribute. I knwo that the Algolia Extension submits those values to Algolia correctly that way.

But as the data is put in Magento automatically from an external system, it would be easier for us to use text attributes with a delimiter between the values.


color: red|blue

Tomorrow the external system adds a new value, so it would be:
color: red|blue|green

Can we configure this attribute in the Algolia backend so this is treated as multiselect fields?

Otherwise we would have to add the option “green” to magento first, and then do a mapping to the ID of the new option to add the “green”. Using texts with delimiters would be much easier, because then it could stay fully automated.


Hi @j.kuschezki_showcase! To change the way the color attribute is being indexed, I would recommend to review on of our backend dispatched events to modify the data before indexing:


You can see this dispatched here:

You can modify the object data before it indexes by creating an observer for that dispatched event.

The reason why we index as an array is for facet filtering purposes. If you are using instantsearch and need to filter by color, please make sure you adjust accordingly. You can review our documentation on all our frontend and backend events here: