Script Filter

See Script Filter

FilterBuilder filter = scriptFilter(
        "doc['age'].value > param1" 
    ).addParam("param1", 10);       

script to execute

parameters

Note that you can cache the result using ScriptFilterBuilder#cache(boolean) method. See Caching.