Filter always by e.g. active=true

I have a quick question and hope somebody can help. Sorry, I am new here and although I read already some docs my wording might be a bit off.
But I have a simple question: I have an index “Objects” - and no matter what query comes in, I only want items that have the field “active” as “True” in the results.
Where is the smart thing to do that? I don’t want to add it to every query…? Thanks a lot!

Hi @webwurm6

Great minds must think a like! There was a similar post from another user – read what I said to them:

Your solution is the same. One thing I will add for you – it sounds like you want to prevent the user from ever seeing the non-active records. You can add further protection by adding the filter to a secure API key and only using that key on the front end. The filter will then be part of request on the front end.

Thanks a lot, the idea with the secured API key is great - I will try that out!
Just one more question: Is it possible to set a permanent filter of active=true in the Algolia-Dashboard?
Thanks again!

1 Like

Not as a configuration for the index. You need to do it either in the API Key or the client configuration.

1 Like

To ensure that only items with the “active” field set to “True” are included in the results for any query on the “Objects” index, you can utilize index-level filtering. This approach allows you to determine a filter that is automatically applied to all queries executed on that index. By configuring the index level filter, you eliminate the need to manually add the filter to every query. Regards