Examples of prepareSearch()


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

    // Wait for river indexation
    Thread.sleep(1000);
   
    // 4 people expected
    assertEquals(4L, client.prepareCount("ldapserver0").setTypes("person").execute().actionGet().getCount());
    assertEquals(3L, client.prepareSearch("ldapserver0").setTypes("person").setQuery(QueryBuilders.fieldQuery("groups", "uidObject")).execute().actionGet().getHits().totalHits());
       
    // But Clint is definitley unique
    assertEquals(1L, client.prepareSearch("ldapserver0").setTypes("person").setQuery(QueryBuilders.fieldQuery("name", "clint")).execute().actionGet().getHits().totalHits());

    assertEquals(1L, client.prepareSearch("ldapserver0").setTypes("person").setQuery(QueryBuilders.queryString("woo")).execute().actionGet().getHits().totalHits());
View Full Code Here

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

    // 4 people expected
    assertEquals(4L, client.prepareCount("ldapserver0").setTypes("person").execute().actionGet().getCount());
    assertEquals(3L, client.prepareSearch("ldapserver0").setTypes("person").setQuery(QueryBuilders.fieldQuery("groups", "uidObject")).execute().actionGet().getHits().totalHits());
       
    // But Clint is definitley unique
    assertEquals(1L, client.prepareSearch("ldapserver0").setTypes("person").setQuery(QueryBuilders.fieldQuery("name", "clint")).execute().actionGet().getHits().totalHits());

    assertEquals(1L, client.prepareSearch("ldapserver0").setTypes("person").setQuery(QueryBuilders.queryString("woo")).execute().actionGet().getHits().totalHits());
    assertEquals(2, client.prepareMultiGet().add("ldapserver0", "person", "christopher").add("ldapserver0", "person", "john").execute().actionGet().getResponses().length);
    }
 
View Full Code Here

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

    assertEquals(3L, client.prepareSearch("ldapserver0").setTypes("person").setQuery(QueryBuilders.fieldQuery("groups", "uidObject")).execute().actionGet().getHits().totalHits());
       
    // But Clint is definitley unique
    assertEquals(1L, client.prepareSearch("ldapserver0").setTypes("person").setQuery(QueryBuilders.fieldQuery("name", "clint")).execute().actionGet().getHits().totalHits());

    assertEquals(1L, client.prepareSearch("ldapserver0").setTypes("person").setQuery(QueryBuilders.queryString("woo")).execute().actionGet().getHits().totalHits());
    assertEquals(2, client.prepareMultiGet().add("ldapserver0", "person", "christopher").add("ldapserver0", "person", "john").execute().actionGet().getResponses().length);
    }
 
  @After
  public void tearDown(){
View Full Code Here

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

  @Bean
  public Client elasticsearch() {
    Client mockClient = Mockito.mock(Client.class);

    Mockito.when(mockClient.prepareSearch(Matchers.anyString())).thenThrow(new ElasticsearchException("no ES here"));

    return mockClient;
  }

}
View Full Code Here

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

        System.out.println("--> Number of docs in index: " + COUNT);

        System.out.println("--> Warmup...");
        // run just the child query, warm up first
        for (int j = 0; j < QUERY_WARMUP; j++) {
            SearchResponse searchResponse = client.prepareSearch()
                    .setQuery(matchAllQuery())
                    .addAggregation(histogram("l_value").field("l_value").interval(4))
                    .addAggregation(histogram("i_value").field("i_value").interval(4))
                    .addAggregation(histogram("s_value").field("s_value").interval(4))
                    .addAggregation(histogram("b_value").field("b_value").interval(4))
View Full Code Here

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

        long totalQueryTime = 0;
        for (String field : new String[] {"b_value", "s_value", "i_value", "l_value"}) {
            totalQueryTime = 0;
            for (int j = 0; j < QUERY_COUNT; j++) {
                SearchResponse searchResponse = client.prepareSearch()
                        .setQuery(matchAllQuery())
                        .addAggregation(histogram(field).field(field).interval(4))
                        .execute().actionGet();
                if (searchResponse.getHits().totalHits() != COUNT) {
                    System.err.println("--> mismatch on hits");
View Full Code Here

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

            }
            System.out.println("--> Histogram Aggregation (" + field + ") " + (totalQueryTime / QUERY_COUNT) + "ms");

            totalQueryTime = 0;
            for (int j = 0; j < QUERY_COUNT; j++) {
                SearchResponse searchResponse = client.prepareSearch()
                        .setQuery(matchAllQuery())
                        .addAggregation(histogram(field).field(field).subAggregation(stats(field).field(field)).interval(4))
                        .execute().actionGet();
                if (searchResponse.getHits().totalHits() != COUNT) {
                    System.err.println("--> mismatch on hits");
View Full Code Here

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

            System.out.println("--> Histogram Aggregation (" + field + "/" + field + ") " + (totalQueryTime / QUERY_COUNT) + "ms");
        }

        totalQueryTime = 0;
        for (int j = 0; j < QUERY_COUNT; j++) {
            SearchResponse searchResponse = client.prepareSearch()
                    .setQuery(matchAllQuery())
                    .addAggregation(dateHistogram("date").field("date").interval(1000))
                    .execute().actionGet();
            if (searchResponse.getHits().totalHits() != COUNT) {
                System.err.println("--> mismatch on hits");
View Full Code Here

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

        }
        System.out.println("--> Histogram Aggregation (date) " + (totalQueryTime / QUERY_COUNT) + "ms");

        totalQueryTime = 0;
        for (int j = 0; j < QUERY_COUNT; j++) {
            SearchResponse searchResponse = client.prepareSearch()
                    .setQuery(matchAllQuery())
                    .addAggregation(dateHistogram("date").field("date").interval(1000).subAggregation(stats("stats").field("l_value")))
                    .execute().actionGet();
            if (searchResponse.getHits().totalHits() != COUNT) {
                System.err.println("--> mismatch on hits");
View Full Code Here

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

            }
            for (String field : new String[] {"low_card_str_value", "low_card_str_value.hash", "high_card_str_value", "high_card_str_value.hash", "low_card_num_value", "high_card_num_value"}) {
                long start = System.nanoTime();
                SearchResponse resp = null;
                for (int j = 0; j < ITERS; ++j) {
                    resp = client.prepareSearch("index").setSearchType(SearchType.COUNT).addAggregation(cardinality("cardinality").field(field)).execute().actionGet();
                }
                long end = System.nanoTime();
                final long cardinality = ((Cardinality) resp.getAggregations().get("cardinality")).getValue();
                if (i >= WARM) {
                    System.out.println(field + "\t" + new TimeValue((end - start) / ITERS, TimeUnit.NANOSECONDS) + "\tcardinality=" + cardinality);
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.