This is a Query pipeline step

You may find that you want to add a default filter to every search request. For example, if you are an ecommerce store that never wants to show products that are out of stock, then it makes sense to add a filter that removes all products with an inventory of 0.

First decide what field you will be filtering. For our example we will be filtering out every record that has an inventoryof less than 0.

Navigate to Relevance > Textual Relevance > Advanced and place the following in your pipeline:

- id: add-filter
  params:
    filter:
      constant: inventory > 0
YAML

First preview the changes to see if it’s working as you expect, and if it is then go ahead and save the pipeline and publish!

Now for every search request, if a record has an inventory of 0 or less than 0, it won’t show in the search results.