Package org.elasticsearch.client

Examples of org.elasticsearch.client.Client


        return xmlBeans;
    }
 
  @Test
  public void test_wrong_classpath() {
        Client client = checkClient("esClient");
        assertThat("tweet type should not exist in twitter index", isMappingExist(client, "twitter", "tweet"), is(false));
  }
View Full Code Here


        return xmlBeans;
    }

  @Test
  public void test_number_of_shards() {
        Client client = checkClient();

        // We test how many shards and replica we have
        ClusterStateResponse response = client.admin().cluster().prepareState().execute().actionGet();
        assertThat(response.getState().getMetaData().getIndices().get("twitter").getNumberOfShards(), is(3));
        assertThat(response.getState().getMetaData().getIndices().get("twitter").getNumberOfReplicas(), is(2));
    }
View Full Code Here

        return xmlBeans;
    }

  @Test
  public void test_transport_client() {
    Client client = checkClient();
        assertThat(client, instanceOf(org.elasticsearch.client.transport.TransportClient.class));

        TransportClient tClient = (TransportClient) client;
        ImmutableList<TransportAddress> adresses = tClient.transportAddresses();
        assertThat(adresses, not(emptyCollectionOf(TransportAddress.class)));
View Full Code Here

        return xmlBeans;
    }

   @Test
  public void test_multiple_nodes() {
    Client client = checkClient("testNodeClient");
    assertThat(client, instanceOf(org.elasticsearch.client.transport.TransportClient.class));

        NodesInfoResponse nodeInfos = client.admin().cluster().prepareNodesInfo().get();
        assertThat(nodeInfos.getNodes().length, is(2));
  }
View Full Code Here

        return xmlBeans;
    }

  @Test
  public void test_node_client() {
    Client client = checkClient("testNodeClient");
        assertThat(client, instanceOf(org.elasticsearch.client.node.NodeClient.class));
  }
View Full Code Here

        return xmlBeans;
    }

    @Test
    public void test_alias() {
        Client client = checkClient();

        GetAliasesResponse response = client.admin().indices().prepareGetAliases().get();
        assertThat(response.getAliases().size(), is(2));
    }
View Full Code Here

        return xmlBeans;
    }

  @Test
  public void test_merge_mapping() throws IOException {
    Client client = checkClient("esClient");
    checkClient("esClient2");

        MappingMetaData response = client.admin().indices().prepareGetMappings().get().getMappings().get("twitter").get("tweet");
        String mapping = new String(response.source().uncompressed());
        // This one comes from the first mapping
        assertThat(mapping, containsString("message"));
        // This one comes from the second mapping
        assertThat(mapping, containsString("author"));
View Full Code Here

        return xmlBeans;
    }

  @Test
  public void test_multiple_clients() {
    Client client = checkClient("esClient");
        Client client2 = checkClient("esClient2");

        // We test how many shards and replica we have
        ClusterStateResponse response = client.admin().cluster().prepareState().execute().actionGet();
        assertThat(response.getState().getMetaData().getIndices().get("twitter").getNumberOfShards(), is(1));

        // We don't expect the number of replicas to be 4 as we won't merge _update_settings.json
        // See #31: https://github.com/dadoonet/spring-elasticsearch/issues/31
        assertThat(response.getState().getMetaData().getIndices().get("twitter").getNumberOfReplicas(), is(0));

        // Let's do the same thing with the second client
        // We test how many shards and replica we have
        response = client2.admin().cluster().prepareState().execute().actionGet();
        assertThat(response.getState().getMetaData().getIndices().get("twitter").getNumberOfShards(), is(1));

        // We don't expect the number of replicas to be 4 as we won't merge _update_settings.json
        // See #31: https://github.com/dadoonet/spring-elasticsearch/issues/31
        assertThat(response.getState().getMetaData().getIndices().get("twitter").getNumberOfReplicas(), is(0));
View Full Code Here

    @Test
    public void test_node_client() throws ExecutionException, InterruptedException {
        Node node = ctx.getBean(Node.class);
        Assert.assertNotNull(Proxy.getInvocationHandler(node));
        Client client = checkClient("testNodeClient");
        Assert.assertNotNull(Proxy.getInvocationHandler(client));

        checkClient("testNodeClient");
        client.admin().cluster().prepareState().execute().get();
    }
View Full Code Here

        return xmlBeans;
    }

  @Test
  public void test_update_settings() {
        Client client = checkClient("esClient");
        checkClient("esClient2");

        // We test how many shards and replica we have
        ClusterStateResponse response = client.admin().cluster().prepareState().execute().actionGet();
        assertThat(response.getState().getMetaData().getIndices().get("twitter").getNumberOfShards(), is(1));
        assertThat(response.getState().getMetaData().getIndices().get("twitter").getNumberOfReplicas(), is(1));
    }
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.