Package com.dotcms.repackage.org.elasticsearch.client

Examples of com.dotcms.repackage.org.elasticsearch.client.AdminClient


    /**
     * returns cluster health
     * @return
     */
    public Map<String,ClusterIndexHealth> getClusterHealth() {
        AdminClient client=new ESClient().getClient().admin();

        ClusterHealthRequest req = new ClusterHealthRequest();
        ActionFuture<ClusterHealthResponse> chr = client.cluster().health(req);

        ClusterHealthResponse res  = chr.actionGet();
        Map<String,ClusterIndexHealth> map  = res.getIndices();

        return map;
View Full Code Here


    public Response getESClusterStatus ( @Context HttpServletRequest request, @PathParam ("params") String params ) throws DotStateException, DotDataException, DotSecurityException, JSONException {

        InitDataObject initData = init( params, true, request, false, "9" );
        ResourceResponse responseResource = new ResourceResponse( initData.getParamsMap() );

        AdminClient client=null;

        JSONObject jsonNode = new JSONObject();

        try {
          client = new ESClient().getClient().admin();
        } catch (Exception e) {
          Logger.error(ClusterResource.class, "Error getting ES Client", e);
          jsonNode.put("error", e.getMessage());
          return responseResource.response( jsonNode.toString() );
        }

    ClusterHealthRequest clusterReq = new ClusterHealthRequest();
    ActionFuture<ClusterHealthResponse> afClusterRes = client.cluster().health(clusterReq);
    ClusterHealthResponse clusterRes = afClusterRes.actionGet();


    jsonNode.put("clusterName", clusterRes.getClusterName());
    jsonNode.put("numberOfNodes", clusterRes.getNumberOfNodes());
View Full Code Here

TOP

Related Classes of com.dotcms.repackage.org.elasticsearch.client.AdminClient

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.