Drop message if tag is search and message has multiple strings

I am looking for dropping a message from the tag search if message has
the following strings.

if "WARN" in [message] { drop{ } }
if ".java:" in [message] { drop{ } }
if "has open connections " in [message]

How can I achieve this, will the below approach work

filter {
if "search" in [tags] and [message] =~ /(WARN|has open connections|.java:)/ { drop{} }

I would expect that to work.

No its not working.

Messages are not getting dropped.