This is for performance reasons. To achieve searches and filtering in a few milliseconds, we need to index the data and the filters prior to your query.
So you must add your attribute(s) to the
attributesForFaceting setting first.
If you know that you are only going to use it for filtering and not faceting, you can specify this to the engine for improved performance like this:
'attributesForFaceting': ['filterOnly(country)', 'filterOnly(city)']
Hope that helps!