Package org.elasticsearch.action.admin.cluster.state

Examples of org.elasticsearch.action.admin.cluster.state.ClusterStateResponse


        // Convert this generic list into a list of indexes that actually exists
        // (ie duplicate the _alias call that is made in non-timestamp cases)
        // (https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/get/RestGetIndicesAliasesAction.java)
       
        ElasticSearchManager indexMgr = ElasticSearchManager.getIndex(RECS_DUMMY_INDEX);
        ClusterStateResponse retVal = indexMgr.getRawClient().admin().cluster().prepareState()
            .setIndices(indexes)
            .setRoutingTable(false).setNodes(false).setListenerThreaded(false).get();

        for (IndexMetaData indexMetadata: retVal.getState().getMetaData()) {
          String index = indexMetadata.index();

          // For docs, only allowed to look at indexes that have been "fixed"
          if (index.startsWith("docs_") || index.startsWith("doc_")) {
            try {
View Full Code Here


      Fixtures.loadModels("analysis-data.yml");
   
    adminClient = ElasticSearchPlugin.client().admin();
   
    // Check custom settings on index
        ClusterStateResponse response = adminClient.cluster().prepareState()
                .execute().actionGet();

        indexSettings = response.state().metaData().index("models_product").settings();
  }
View Full Code Here

        Settings storeSettings = toDynamicSettings(settings);

        _client.getClient().admin().indices().prepareUpdateSettings(_indexName).setSettings(storeSettings)
            .execute().actionGet();

        ClusterStateResponse state = _client.getClient().admin().cluster().prepareState()
            .setFilterIndices(_indexName).setFilterAll().setFilterMetaData(false).execute().actionGet();

        Settings indexSettings = state.getState().getMetaData().getIndices().get(_indexName).getSettings();

        for (Entry<String, String> e : settings.getAsMap().entrySet()) {
          String key = e.getKey();
          String localValue = e.getValue();
          String indexValue = indexSettings.get(key.startsWith("index.") ? key : "index." + key);
View Full Code Here

        public void run() {
            boolean reschedule = true;
            try {
                ClusterAdminClient clusterAdminClient = adminClient.cluster();

                ClusterStateResponse state = clusterAdminClient.state(clusterAdminClient.prepareState().request()).actionGet();

                if (!state.getState().nodes().getLocalNode().isMasterNode()) {
                    return;
                }

                Set<String> toClose = new HashSet<>();
                Set<String> toDelete = new HashSet<>();

                // Compute things to do
                LocalDate now = new LocalDate();
                for (ObjectObjectCursor<String, IndexMetaData> it : state.getState().metaData().indices()) {
                    String index = it.value.getIndex();
                    Matcher matcher = pattern.matcher(index);

                    if (matcher.find()) {
                        LocalDate date = new LocalDate(Integer.parseInt(matcher.group(1)),
View Full Code Here

        ClusterStateRequest request = Requests.clusterStateRequest()
                .routingTable(false)
                .nodes(false)
                .metaData(true)
                .indices(index);
        ClusterStateResponse response = client().admin().cluster().state(request)
                .actionGet();

        MetaData metaData = response.getState().metaData();
        XContentBuilder builder = XContentFactory.jsonBuilder().startObject();

        IndexMetaData indexMetaData = metaData.iterator().next();
        for (ObjectCursor<MappingMetaData> cursor: indexMetaData.mappings().values()) {
            builder.field(cursor.value.type());
View Full Code Here

        ClusterStateRequest request = Requests.clusterStateRequest()
                .routingTable(false)
                .nodes(false)
                .metaData(true)
                .indices(index);
        ClusterStateResponse response = client().admin().cluster().state(request)
                .actionGet();

        MetaData metaData = response.getState().metaData();
        XContentBuilder builder = XContentFactory.jsonBuilder().startObject();

        for (IndexMetaData indexMetaData : metaData) {
            builder.startObject(indexMetaData.index(), XContentBuilder.FieldCaseConversion.NONE);
            builder.startObject("settings");
View Full Code Here

            fulltextAnalyzerResolver = null;
        }
    }

    public Settings getPersistentClusterSettings() {
        ClusterStateResponse response = client().admin().cluster().prepareState().execute().actionGet();
        return response.getState().metaData().persistentSettings();
    }
View Full Code Here

                // ignore
            } catch (ElasticsearchIllegalArgumentException e) {
                // Happens if `action.destructive_requires_name` is set to true
                // which is the case in the CloseIndexDisableCloseAllTests
                if ("_all".equals(indices[0])) {
                    ClusterStateResponse clusterStateResponse = client().admin().cluster().prepareState().execute().actionGet();
                    ObjectArrayList<String> concreteIndices = new ObjectArrayList<String>();
                    for (IndexMetaData indexMetaData : clusterStateResponse.getState().metaData()) {
                        concreteIndices.add(indexMetaData.getIndex());
                    }
                    if (!concreteIndices.isEmpty()) {
                        assertAcked(client().admin().indices().prepareDelete(concreteIndices.toArray(String.class)));
                    }
View Full Code Here

  @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

  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

TOP

Related Classes of org.elasticsearch.action.admin.cluster.state.ClusterStateResponse

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.