Facets on field text array

Faceting on Array Field in Elasticsearch with @elastic/react-search-ui

I have an engine with documents containing a countries array:

countries: ['Spain', 'Italy']
countries: ['Spain']
countries: ['Spain', 'Germany']

I would like to know how I can include a facet, so when I select 'Spain', it returns all 3 documents that contain 'Spain' in the array.

I am using the @elastic/react-search-ui library.

Currently, if I select 'Spain', it only returns the document that has exactly 'Spain'. The documents that contain 'Spain' along with other values are not returned.

I was wondering if this is expected behavior, or if it's possible to return documents where 'Spain' is part of an array, even if there are other values in that array.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.