# Facets on field text array

**URL:** <https://discuss.elastic.co/t/facets-on-field-text-array/376224>\
**Category:** Elastic Search\
**Created:** [March 21, 2025, 12:09pm UTC](https://discuss.elastic.co/t/facets-on-field-text-array/376224 "2025-03-21T12:09:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lluis\_Semper\_Lloret](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lluis_semper_lloret/32/142180_2.png) [@Lluis\_Semper\_Lloret](https://discuss.elastic.co/u/Lluis_Semper_Lloret)\
**Post date:** [March 21, 2025, 12:09pm UTC](https://discuss.elastic.co/t/facets-on-field-text-array/376224/1 "2025-03-21T12:09:24Z")

</div>

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

I have an engine with documents containing a `countries` array:

```json
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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 18, 2025, 12:09pm UTC](https://discuss.elastic.co/t/facets-on-field-text-array/376224/2 "2025-04-18T12:09:25Z")

</div>

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