Can I filter logs with if else condition?

my logs chain is
Filebeat => Logstash => Elasticsearch
Now i want to filterize logs with my own field.
like match or if else condition key value.

So Can I do that or what? need to know how can i do?
any blog suggestion?

Here you go: https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html#conditionals