How to pass a list of items to filter records on a repeated field?

Answer

You can filter records to match items (sent in a search request as a list) to return records that contain those items. As an example, consider the following query:

{
  "q": "",
  "itemsList": "items ~ ['classic','casual-functional']"
}
CODE
  • where “items” is a repeated field

  • itemsList is a param being sent in the request

  • “classic” and “casual-functional“ are example values on the record

To enable such queries, you can use the “add-filter” a step in the pipeline:

- id: add-filter
  params:
    filter:
      bind: itemsList
  condition: itemsList != ''
CODE

You can also use the escape character syntax if case your values contain ' or “ symbol "itemsList": "itemField ~ [\"value1\",\"value2\"]"