Package org.elasticsearch.client

Examples of org.elasticsearch.client.Client.prepareSearch()


        System.out.println("--> top_children Query Avg: " + (totalQueryTime / QUERY_COUNT) + "ms");

        System.out.println("--> Running top_children query, with match_all as child query");
        // run parent child score query
        for (int j = 0; j < QUERY_WARMUP; j++) {
            client.prepareSearch(indexName).setQuery(topChildrenQuery("child", matchAllQuery())).execute().actionGet();
        }

        totalQueryTime = 0;
        for (int j = 0; j < QUERY_COUNT; j++) {
            SearchResponse searchResponse = client.prepareSearch(indexName).setQuery(topChildrenQuery("child", matchAllQuery())).execute().actionGet();
View Full Code Here


            client.prepareSearch(indexName).setQuery(topChildrenQuery("child", matchAllQuery())).execute().actionGet();
        }

        totalQueryTime = 0;
        for (int j = 0; j < QUERY_COUNT; j++) {
            SearchResponse searchResponse = client.prepareSearch(indexName).setQuery(topChildrenQuery("child", matchAllQuery())).execute().actionGet();
            if (j % 10 == 0) {
                System.out.println("--> hits [" + j + "], got [" + searchResponse.getHits().totalHits() + "]");
            }
            totalQueryTime += searchResponse.getTookInMillis();
        }
View Full Code Here

        System.out.println("--> Used heap size: " + statsResponse.getNodes()[0].getJvm().getMem().getHeapUsed());

        System.out.println("--> Running has_child query with score type");
        // run parent child score query
        for (int j = 0; j < QUERY_WARMUP; j++) {
            client.prepareSearch(indexName).setQuery(hasChildQuery("child", termQuery("field2", parentChildIndexGenerator.getQueryValue())).scoreType("max")).execute().actionGet();
        }

        totalQueryTime = 0;
        for (int j = 0; j < QUERY_COUNT; j++) {
            SearchResponse searchResponse = client.prepareSearch(indexName).setQuery(hasChildQuery("child", termQuery("field2", parentChildIndexGenerator.getQueryValue())).scoreType("max")).execute().actionGet();
View Full Code Here

            client.prepareSearch(indexName).setQuery(hasChildQuery("child", termQuery("field2", parentChildIndexGenerator.getQueryValue())).scoreType("max")).execute().actionGet();
        }

        totalQueryTime = 0;
        for (int j = 0; j < QUERY_COUNT; j++) {
            SearchResponse searchResponse = client.prepareSearch(indexName).setQuery(hasChildQuery("child", termQuery("field2", parentChildIndexGenerator.getQueryValue())).scoreType("max")).execute().actionGet();
            if (j % 10 == 0) {
                System.out.println("--> hits [" + j + "], got [" + searchResponse.getHits().totalHits() + "]");
            }
            totalQueryTime += searchResponse.getTookInMillis();
        }
View Full Code Here

        }
        System.out.println("--> has_child Query Avg: " + (totalQueryTime / QUERY_COUNT) + "ms");
       
        totalQueryTime = 0;
        for (int j = 0; j < QUERY_COUNT; j++) {
            SearchResponse searchResponse = client.prepareSearch(indexName).setQuery(hasChildQuery("child", matchAllQuery()).scoreType("max")).execute().actionGet();
            if (j % 10 == 0) {
                System.out.println("--> hits [" + j + "], got [" + searchResponse.getHits().totalHits() + "]");
            }
            totalQueryTime += searchResponse.getTookInMillis();
        }
View Full Code Here

        System.out.println("--> has_child query with match_all Query Avg: " + (totalQueryTime / QUERY_COUNT) + "ms");
       
        System.out.println("--> Running has_parent query with score type");
        // run parent child score query
        for (int j = 0; j < QUERY_WARMUP; j++) {
            client.prepareSearch(indexName).setQuery(hasParentQuery("parent", termQuery("field1", parentChildIndexGenerator.getQueryValue())).scoreType("score")).execute().actionGet();
        }

        totalQueryTime = 0;
        for (int j = 1; j < QUERY_COUNT; j++) {
            SearchResponse searchResponse = client.prepareSearch(indexName).setQuery(hasParentQuery("parent", termQuery("field1", parentChildIndexGenerator.getQueryValue())).scoreType("score")).execute().actionGet();
View Full Code Here

            client.prepareSearch(indexName).setQuery(hasParentQuery("parent", termQuery("field1", parentChildIndexGenerator.getQueryValue())).scoreType("score")).execute().actionGet();
        }

        totalQueryTime = 0;
        for (int j = 1; j < QUERY_COUNT; j++) {
            SearchResponse searchResponse = client.prepareSearch(indexName).setQuery(hasParentQuery("parent", termQuery("field1", parentChildIndexGenerator.getQueryValue())).scoreType("score")).execute().actionGet();
            if (j % 10 == 0) {
                System.out.println("--> hits [" + j + "], got [" + searchResponse.getHits().totalHits() + "]");
            }
            totalQueryTime += searchResponse.getTookInMillis();
        }
View Full Code Here

        }
        System.out.println("--> has_parent Query Avg: " + (totalQueryTime / QUERY_COUNT) + "ms");

        totalQueryTime = 0;
        for (int j = 1; j < QUERY_COUNT; j++) {
            SearchResponse searchResponse = client.prepareSearch(indexName).setQuery(hasParentQuery("parent", matchAllQuery()).scoreType("score")).execute().actionGet();
            if (j % 10 == 0) {
                System.out.println("--> hits [" + j + "], got [" + searchResponse.getHits().totalHits() + "]");
            }
            totalQueryTime += searchResponse.getTookInMillis();
        }
View Full Code Here

        System.out.println("Warming up...");
        char startChar = 'a';
        for (int i = 0; i <= 20; i++) {
            String term = "prefix" + startChar;
            SearchResponse response = client.prepareSearch()
                    .setQuery(prefixQuery("field", term))
                    .addSuggestion(SuggestBuilders.termSuggestion("field").field("field").text(term).suggestMode("always"))
                    .execute().actionGet();
            if (response.getHits().totalHits() == 0) {
                System.err.println("No hits");
View Full Code Here

        System.out.println("Starting benchmarking suggestions.");
        startChar = 'a';
        long timeTaken = 0;
        for (int i = 0; i <= SEARCH_ITERS; i++) {
            String term = "prefix" + startChar;
            SearchResponse response = client.prepareSearch()
                    .setQuery(matchQuery("field", term))
                    .addSuggestion(SuggestBuilders.termSuggestion("field").text(term).field("field").suggestMode("always"))
                    .execute().actionGet();
            timeTaken += response.getTookInMillis();
            if (response.getSuggest() == null) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.