Filter BY Array

Hi, I have an array in Algolia that has a list of text, set up as ‘filter only’ in the Attributes for faceting.

I’d like to pass an array to Algolia and cross compare the lists. Is this possible? I’ve seen some hacky answers on SO from years ago (Algolia: Filter Index by string array attribute with a string array of possible values - Stack Overflow).


Item 1: Array[A,B,C,D]
Item 2: Array[C,E,F,G]
Item 3: Array[B,H,I]

FILTER: Array[B,H]

RESULT: Item 1, Item 2

Hi @andrewmccalister,

It’s not currently possible to use an array as an attribute value for a filter. You can only use strings, numerics, and booleans as values for filters. As StackOverflow article you linked to mentions, you’ll need to deconstruct your list into a chain of individual values.‘query’, {
filters: ‘array:B AND array:H’
}).then({ hits } => {

This is detailed here in documentation: filters API parameter | Algolia

1 Like