Package org.elasticsearch.client

Examples of org.elasticsearch.client.Client


                    };
                }
            }
        }).when(indexInfo).create(any(Message.class));

        Client client = mock(Client.class);
        ActionFuture<BulkResponse> responseActionFuture = mock(ActionFuture.class);
        BulkResponse response = getBulkItemResponses();
        doReturn(response).when(responseActionFuture).actionGet();
        doReturn(responseActionFuture).when(client).bulk(any(BulkRequest.class));
View Full Code Here


        clients.put(id, node.client());
        return node;
    }

    public void closeNode(String id) {
        Client client = clients.remove(id);
        if (client != null) {
            client.close();
        }
        Node node = nodes.remove(id);
        if (node != null) {
            node.close();
        }
View Full Code Here

        clients.put(id, node.client());
        return node;
    }

    public void closeNode(String id) {
        Client client = clients.remove(id);
        if (client != null) {
            client.close();
        }
        Node node = nodes.remove(id);
        if (node != null) {
            node.close();
        }
View Full Code Here

  Node node = null;
 
  @Before
  public void setUp() throws Exception{
    node = NodeBuilder.nodeBuilder().local(true).node();
    Client client = node.client();
   
    try {
      client.admin().indices().prepareDelete("_river", "ldapserver0").execute().actionGet();
    } catch (IndexMissingException e) {
      // Ok
    }
   
    Thread.sleep(1000);
View Full Code Here

    node.client().prepareIndex("_river", "my_ldap_river", "_meta").setRefresh(true).setSource(xb).execute().actionGet();
  }
 
  @Test
    public void testLdapRiver() throws Exception {
    Client client = node.client();
   
    // 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());
    assertEquals(2, client.prepareMultiGet().add("ldapserver0", "person", "christopher").add("ldapserver0", "person", "john").execute().actionGet().getResponses().length);
    }
View Full Code Here

  }

  private Client getSearchClient() {
    Settings settings = ImmutableSettings.settingsBuilder()
      .put("cluster.name", CLUSTER_NAME).build();
    Client client = new TransportClient(settings)
      .addTransportAddress(new InetSocketTransportAddress("localhost", port));
    assertThat(client.admin().cluster().prepareClusterStats().get().getStatus()).isEqualTo(ClusterHealthStatus.GREEN);
    return client;
  }
View Full Code Here

    return properties;
  }

  @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

    return this;
  }

  public Client build() {
    // Build the elasticsearch client
    Client client = nodeClient ? buildNodeClient() : buildTransportClient();
    // Ensure client is connected
    checkConnection(client);
    // Return valid client
    return client;
  }
View Full Code Here

  @Override
  protected TaskManager createTaskManagerImpl(TaskConfiguration taskConfig) {
    // Retrieve parameters
    Parameters params = buildPluginParameters(taskConfig);
    // Build ElasticSearch client
    Client client = buildElasticsearchClient(params);
    // Build indexAdminService
    IndexAdminService indexAdminService = new IndexAdminService(client);
    // Build EntityDao
    EntityDao entityDao = buildEntityDao(client, params);
    // Create bundle
View Full Code Here

        clients.put(id, node.client());
        return node;
    }

    public void closeNode(String id) {
        Client client = clients.remove(id);
        if (client != null) {
            client.close();
        }
        Node node = nodes.remove(id);
        if (node != null) {
            node.close();
        }
View Full Code Here

TOP

Related Classes of org.elasticsearch.client.Client

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.