Filter by field only if the field exists

@all9lives

Within Elasticsearch query context if you are using should with must (clearly is your case), you should provide minimum_should_match parameter equal to 1 so that your should clause is evaluated as well.

https://www.elastic.co/guide/en/elasticsearch/reference/6.6/query-dsl-bool-query.html

Hope this helps out.