Elastic App Search Filter targeting CSV field

243 Views Asked by At

We have a field in our Elastic App Search called «categories», containing the value «fruit, vegetables».

In our paylod we are trying to filter the search by «fruit». But as the filter needs to be an exact match, we don’t get any results.

There must be a way to match a filter with the comma separated document value, right?

1

There are 1 best solutions below

1
On BEST ANSWER

App Search supports arrays for filtering, so instead of indexing that field as "fruit, vegetables", provide it as ["fruit", "vegetables"] and they will be considered as independent values for the document, which would match for either of them.

Reference: https://www.elastic.co/guide/en/app-search/current/filters.html