Package org.elasticsearch.index.query.functionscore.script

Examples of org.elasticsearch.index.query.functionscore.script.ScriptScoreFunctionBuilder


        for (int nTerms = minTerms; nTerms < maxTerms; nTerms++) {
            Map<String, Object> params = new HashMap<>();
            String[] terms = getTerms(nTerms + 1);
            params.put("text", terms);
            String infoString = "Results for native script with " + (nTerms + 1) + " terms:";
            ScriptScoreFunctionBuilder scriptFunction = (langNative == true) ? scriptFunction(script, "native", params) : scriptFunction(
                    script, params);
            SearchRequest request = searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
                    searchSource()
                            .explain(false)
                            .size(0)
View Full Code Here


    }

    static List<Entry<String, RequestInfo>> initScriptMatchAllSearchRequests(String script, boolean langNative) {
        List<Entry<String, RequestInfo>> nativeSearchRequests = new ArrayList<>();
        String infoString = "Results for constant score script:";
        ScriptScoreFunctionBuilder scriptFunction = (langNative == true) ? scriptFunction(script, "native") : scriptFunction(script);
        SearchRequest request = searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
                searchSource().explain(false).size(0)
                        .query(functionScoreQuery(FilterBuilders.matchAllFilter(), scriptFunction).boostMode(CombineFunction.REPLACE)));
        nativeSearchRequests.add(new AbstractMap.SimpleEntry<>(infoString, new RequestInfo(request, 0)));
View Full Code Here

           dependent to run massive benchmarks and do busy waiting. */
        internalCluster(); // mark that we need a JVM local cluster!
        waitForQuery = new CountDownLatch(1);
        waitForTestLatch = new CountDownLatch(1);
        String className = "BenchmarkIntegrationTest";
        ScriptScoreFunctionBuilder scriptFunction = scriptFunction("import " + this.getClass().getName() + "; \n" +
                className + ".waitForQuery.countDown(); \n" + className + ".waitForTestLatch.await(); \n return 1.0;");
        SearchRequest searchRequest = searchRequest().source(
                searchSource()
                        .query(functionScoreQuery(FilterBuilders.matchAllFilter(), scriptFunction)));
        return  searchRequest;
View Full Code Here

        List<SearchRequest> reqList = new ArrayList<>();
        int numQueries = scaledRandomIntBetween(20, 100);
        int numErrors = scaledRandomIntBetween(1, numQueries);
        final boolean containsFatal = randomBoolean();
        if (containsFatal) {
            ScriptScoreFunctionBuilder scriptFunction = scriptFunction("DOES NOT COMPILE - fails on any shard");
            SearchRequest searchRequest = searchRequest().source(
                    searchSource()
                            .query(functionScoreQuery(FilterBuilders.matchAllFilter(), scriptFunction)));
            reqList.add(searchRequest);

        }
        for (int i = 0; reqList.size() < numErrors; i++) {
            ScriptScoreFunctionBuilder scriptFunction = scriptFunction("throw new RuntimeException();");
            SearchRequest searchRequest = searchRequest().source(
                    searchSource()
                            .query(functionScoreQuery(FilterBuilders.matchAllFilter(), scriptFunction)));
            reqList.add(searchRequest);
        }
View Full Code Here

    public static LinearDecayFunctionBuilder linearDecayFunction(String fieldName, Object scale) {
        return new LinearDecayFunctionBuilder(fieldName, null, scale);
    }

    public static ScriptScoreFunctionBuilder scriptFunction(String script) {
        return (new ScriptScoreFunctionBuilder()).script(script);
    }
View Full Code Here

    public static ScriptScoreFunctionBuilder scriptFunction(String script) {
        return (new ScriptScoreFunctionBuilder()).script(script);
    }

    public static ScriptScoreFunctionBuilder scriptFunction(String script, String lang) {
        return (new ScriptScoreFunctionBuilder()).script(script).lang(lang);
    }
View Full Code Here

    public static ScriptScoreFunctionBuilder scriptFunction(String script, String lang) {
        return (new ScriptScoreFunctionBuilder()).script(script).lang(lang);
    }

    public static ScriptScoreFunctionBuilder scriptFunction(String script, String lang, Map<String, Object> params) {
        return (new ScriptScoreFunctionBuilder()).script(script).lang(lang).params(params);
    }
View Full Code Here

    public static ScriptScoreFunctionBuilder scriptFunction(String script, String lang, Map<String, Object> params) {
        return (new ScriptScoreFunctionBuilder()).script(script).lang(lang).params(params);
    }

    public static ScriptScoreFunctionBuilder scriptFunction(String script, Map<String, Object> params) {
        return (new ScriptScoreFunctionBuilder()).script(script).params(params);
    }
View Full Code Here

TOP

Related Classes of org.elasticsearch.index.query.functionscore.script.ScriptScoreFunctionBuilder

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.