How to filter out buildings in osmfilter which has only one tag: building=yes
You can filter this object with query
type:way building=yes tags:1-1
More examples: Searching and filtering
EDIT:
I’m sorry - I thought that you are asking about JOSM filters. I leave this code, because someone can search this type of query for JOSM. Unfortunately I don’t know answer for your question.