Package org.elasticsearch.script

Examples of org.elasticsearch.script.CompiledScript


                    vars);
            localVars.put("container",
                    SingletonS2ContainerFactory.getContainer());
            localVars.put("settings", settings);
            try {
                final CompiledScript compiledScript = scriptService.compile(
                        lang, script, scriptType);
                ExecutableScript executable = scriptService.executable(
                        compiledScript, localVars);
                Object result = executable.run();
                logger.info("[{}] \"{}\" => {}", target, script, result);
View Full Code Here


            scriptType = ScriptType.INDEXED;
        } else {
            scriptType = ScriptType.INLINE;
        }
        final ScriptService scriptService = riverConfig.getScriptService();
        final CompiledScript compiledScript = scriptService.compile(lang,
                script, scriptType);
        ExecutableScript executable = scriptService.executable(compiledScript,
                vars);
        return executable.run();
    }
View Full Code Here

        spare.copyUTF8Bytes(suggestion.getText());
        return new PhraseSuggestion.Entry(new StringText(spare.toString()), 0, spare.length(), cutoffScore);
    }

    private MultiSearchResponse collate(PhraseSuggestionContext suggestion, Result checkerResult, BytesRefBuilder byteSpare, CharsRefBuilder spare) throws IOException {
        CompiledScript collateQueryScript = suggestion.getCollateQueryScript();
        CompiledScript collateFilterScript = suggestion.getCollateFilterScript();
        MultiSearchResponse multiSearchResponse = null;
        if (collateQueryScript != null) {
            multiSearchResponse = fetchMatchingDocCountResponses(checkerResult.corrections, collateQueryScript, false, suggestion, byteSpare, spare);
        } else if (collateFilterScript != null) {
            multiSearchResponse = fetchMatchingDocCountResponses(checkerResult.corrections, collateFilterScript, true, suggestion, byteSpare, spare);
View Full Code Here

                                throw new ElasticsearchIllegalArgumentException("suggester[phrase][collate] filter already set, doesn't support additional [" + fieldName + "]");
                            }
                            if (suggestion.getCollateQueryScript() != null) {
                                throw new ElasticsearchIllegalArgumentException("suggester[phrase][collate] query already set, doesn't support additional [" + fieldName + "]");
                            }
                            CompiledScript compiledScript = suggester.scriptService().compile("mustache", templateNameOrTemplateContent);
                            if ("query".equals(fieldName)) {
                                suggestion.setCollateQueryScript(compiledScript);
                            } else {
                                suggestion.setCollateFilterScript(compiledScript);
                            }
View Full Code Here

TOP

Related Classes of org.elasticsearch.script.CompiledScript

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.