Skip to content

Scipted query #2968

Open
Open
@p-migda

Description

@p-migda

Hi,
Is there any possible way to make something like this using criteria query without runtime or scripted field?

GET index/_search { "query": { "bool": { "must": [ { "nested": { "path": "date", "query": { "bool": { "filter": { "script": { "script": """ ZonedDateTime date = doc['date.date'].value; ZonedDateTime now = params['now']; return date.isBefore(now) """ } } } } } }, { "bool": { "must": [ { "match": { "fieldName": "value" } } ] } } ] } } }

I'm thinking about method something like that
criteria.addScriptedQuery(String script, HashMap<String, Object> params);
Do you think it is possible to make something like this or maybe it is possible already?

edit:
Or run stored script on es in query?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions