[Fixed]What shall i import (Java) for scriptQuery(Script)


(Varun Sharma) #1

In this code snippet :-

QueryBuilder qb = scriptQuery(
new Script("doc['num1'].value > 1")
);
Located here :- ScriptQuery

I'm getting :- "The method scriptQuery(Script) is undefined for the type App"
I have already imported :-
import org.elasticsearch.script.;
import org.elasticsearch.index.query.ScriptQueryBuilder.
;

Is there any other library to import?


(Varun Sharma) #2

Solved with :-

import static org.elasticsearch.index.query.QueryBuilders.scriptQuery;

//Fetched the info from github source code.


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.