This is a generic library for building and executing a complex rule by composing simple logical filters. We will discuss how we (at Helpshift) have built a lightweight rule based engine with a common way to define the criteria (a rule) and a common way to know if some object matches a rule. The rule engine will convert a rule into a query or fetch documents that match the query. The engine will take an object and a series of rules and return all the rules that match the object.