org.elasticsearch.script.SearchScript Java Examples

The following examples show how to use org.elasticsearch.script.SearchScript. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VectorScoringScriptEngineService.java    From fast-elasticsearch-vector-scoring with Apache License 2.0 6 votes vote down vote up
@Override
public SearchScript search(CompiledScript compiledScript, final SearchLookup lookup, @Nullable final Map<String, Object> vars) {
    final VectorScoreScript.Factory scriptFactory = (VectorScoreScript.Factory) compiledScript.compiled();
    final VectorScoreScript script = (VectorScoreScript) scriptFactory.newScript(vars);
    return new SearchScript() {
        @Override
        public LeafSearchScript getLeafSearchScript(LeafReaderContext context) throws IOException {
            script.setBinaryEmbeddingReader(context.reader().getBinaryDocValues(script.field));
            return script;
        }
        @Override
        public boolean needsScores() {
            return scriptFactory.needsScores();
        }
    };
}
 
Example #2
Source File: MustacheScriptEngineService.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public SearchScript search(CompiledScript compiledScript, SearchLookup lookup,
        @Nullable Map<String, Object> vars) {
    throw new UnsupportedOperationException();
}
 
Example #3
Source File: ValuesSourceConfig.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public SearchScript script() {
    return script;
}
 
Example #4
Source File: ValuesSource.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public Script(SearchScript script) {
    this.script = script;
}
 
Example #5
Source File: ValuesSource.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public WithScript(Numeric delegate, SearchScript script) {
    this.delegate = delegate;
    this.script = script;
}
 
Example #6
Source File: ValuesSource.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public Script(SearchScript script, ValueType scriptValueType) {
    this.script = script;
    this.scriptValueType = scriptValueType;
}
 
Example #7
Source File: ValuesSource.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public WithScript(ValuesSource delegate, SearchScript script) {
    this.delegate = delegate;
    this.script = script;
}
 
Example #8
Source File: ValuesSourceParser.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
private SearchScript createScript() {
    return input.script == null ? null : context.scriptService().search(context.lookup(), input.script, ScriptContext.Standard.AGGS, Collections.<String, String>emptyMap());
}
 
Example #9
Source File: ScriptFieldsContext.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public ScriptField(String name, SearchScript script, boolean ignoreException) {
    this.name = name;
    this.script = script;
    this.ignoreException = ignoreException;
}
 
Example #10
Source File: ScriptFieldsContext.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public SearchScript script() {
    return this.script;
}
 
Example #11
Source File: ScriptScoreFunction.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public ScriptScoreFunction(Script sScript, SearchScript script) {
    super(CombineFunction.REPLACE);
    this.sScript = sScript;
    this.script = script;
}