Package org.elasticsearch.action.admin.cluster.stats

Examples of org.elasticsearch.action.admin.cluster.stats.ClusterStatsResponse


    this.profiling = profiling;
  }

  public ClusterHealth getClusterHealth() {
    ClusterHealth health = new ClusterHealth();
    ClusterStatsResponse clusterStatsResponse = this.prepareClusterStats().get();

    // Cluster health
    health.setClusterAvailable(clusterStatsResponse.getStatus() != ClusterHealthStatus.RED);

    // Number of nodes
    health.setNumberOfNodes(clusterStatsResponse.getNodesStats().getCounts().getTotal());

    return health;
  }
View Full Code Here


        return null;
    }

    public void bindNode(Node node) {
        ClusterAdminClient client = node.client().admin().cluster();
        ClusterStatsResponse response = client.prepareClusterStats().execute().actionGet();
        String clusterName = response.getClusterNameAsString();
        Set<Node> nodeSet = nodesClusterMap.get(clusterName);
        if (nodeSet == null) {
            nodeSet = new HashSet<Node>();
            nodesClusterMap.put(clusterName, nodeSet);
        }
View Full Code Here

        nodeSet.add(node);
    }

    public void unbindNode(Node node) {
        ClusterAdminClient client = node.client().admin().cluster();
        ClusterStatsResponse response = client.prepareClusterStats().execute().actionGet();
        String clusterName = response.getClusterNameAsString();
        Set<Node> nodeSet = nodesClusterMap.get(clusterName);
        if (nodeSet != null) {
            nodeSet.remove(node);
            if (nodeSet.isEmpty()) {
                nodesClusterMap.remove(clusterName);
View Full Code Here

        String[] nodeIds = new String[nodes.length];
        for (int i = 0; i < nodeIds.length; i++) {
            nodeIds[i] = nodes[i].injector().getInstance(Discovery.class).localNode().getId();
        }

        ClusterStatsResponse clusterStateResponse = client.admin().cluster().prepareClusterStats().setNodesIds(nodeIds).get();
        System.out.println("--> Heap used: " + clusterStateResponse.getNodesStats().getJvm().getHeapUsed());
        ByteSizeValue fieldDataMemoryUsed = clusterStateResponse.getIndicesStats().getFieldData().getMemorySize();
        System.out.println("--> Fielddata memory size: " + fieldDataMemoryUsed);

        return new StatsResult(name, totalQueryTime, fieldDataMemoryUsed);
    }
View Full Code Here

            totalQueryTime += searchResponse.getTookInMillis();
        }
        System.out.println("--> Terms Agg (" + name + "): " + (totalQueryTime / QUERY_COUNT) + "ms");

        String nodeId = node.injector().getInstance(Discovery.class).localNode().getId();
        ClusterStatsResponse clusterStateResponse = client.admin().cluster().prepareClusterStats().setNodesIds(nodeId).get();
        System.out.println("--> Heap used: " + clusterStateResponse.getNodesStats().getJvm().getHeapUsed());
        ByteSizeValue fieldDataMemoryUsed = clusterStateResponse.getIndicesStats().getFieldData().getMemorySize();
        System.out.println("--> Fielddata memory size: " + fieldDataMemoryUsed);

        return new StatsResult(name, totalQueryTime, fieldDataMemoryUsed);
    }
View Full Code Here

            searchThread.stop();

            System.out.println("--> Avg refresh time: " + refreshThread.avgRefreshTime + " ms");
            System.out.println("--> Avg query time: " + searchThread.avgQueryTime + " ms");

            ClusterStatsResponse clusterStateResponse = client.admin().cluster().prepareClusterStats().setNodesIds(nodeIds).get();
            System.out.println("--> Heap used: " + clusterStateResponse.getNodesStats().getJvm().getHeapUsed());
            ByteSizeValue fieldDataMemoryUsed = clusterStateResponse.getIndicesStats().getFieldData().getMemorySize();
            System.out.println("--> Fielddata memory size: " + fieldDataMemoryUsed);
            testResults.add(new TestResult(testRun.name, refreshThread.avgRefreshTime, searchThread.avgQueryTime, fieldDataMemoryUsed));
        }

        System.out.println("----------------------------------------- SUMMARY ----------------------------------------------");
View Full Code Here

        String[] nodeIds = new String[nodes.length];
        for (int i = 0; i < nodeIds.length; i++) {
            nodeIds[i] = nodes[i].injector().getInstance(Discovery.class).localNode().getId();
        }

        ClusterStatsResponse clusterStateResponse = client.admin().cluster().prepareClusterStats().setNodesIds(nodeIds).get();
        ByteSizeValue heapUsed = clusterStateResponse.getNodesStats().getJvm().getHeapUsed();
        System.out.println("--> Heap used: " + heapUsed);
        ByteSizeValue fieldDataMemoryUsed = clusterStateResponse.getIndicesStats().getFieldData().getMemorySize();
        System.out.println("--> Fielddata memory size: " + fieldDataMemoryUsed);

        return new StatsResult(name, totalQueryTime, fieldDataMemoryUsed, heapUsed);
    }
View Full Code Here

        ensureGreen();

        client().prepareIndex("test", "type", "1").setSource("name", "name").get();
        client().admin().indices().prepareRefresh("test").get();

        ClusterStatsResponse response = client().admin().cluster().prepareClusterStats().get();
        assertThat(response.getIndicesStats().getFieldData().getMemorySizeInBytes(), greaterThan(0l));
    }
View Full Code Here

        ensureGreen();

        client().prepareIndex("test", "type", "1").setSource("name", "name").get();
        client().admin().indices().prepareRefresh("test").get();

        ClusterStatsResponse response = client().admin().cluster().prepareClusterStats().get();
        assertThat(response.getIndicesStats().getFieldData().getMemorySizeInBytes(), greaterThan(0l));
    }
View Full Code Here

TOP

Related Classes of org.elasticsearch.action.admin.cluster.stats.ClusterStatsResponse

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.