Examples of numberOfShards()


Examples of org.elasticsearch.cluster.metadata.IndexMetaData.numberOfShards()

                    MetaData newMetaData = newMetaDataBuilder()
                            .metaData(currentState.metaData())
                            .put(indexMetaData)
                            .build();

                    logger.info("[{}] creating index, cause [{}], shards [{}]/[{}], mappings {}", request.index, request.cause, indexMetaData.numberOfShards(), indexMetaData.numberOfReplicas(), mappings.keySet());

                    ClusterBlocks.Builder blocks = ClusterBlocks.builder().blocks(currentState.blocks());
                    if (!request.blocks.isEmpty()) {
                        for (ClusterBlock block : request.blocks) {
                            blocks.addIndexBlock(request.index, block);
View Full Code Here

Examples of org.elasticsearch.cluster.metadata.IndexMetaData.numberOfShards()

            IndexRoutingTable indexRoutingTable = clusterState.routingTable().index(index);
            IndexMetaData indexMetaData = clusterState.metaData().index(index);
            if (indexRoutingTable == null) {
                continue;
            }
            ClusterIndexHealth indexHealth = new ClusterIndexHealth(index, indexMetaData.numberOfShards(), indexMetaData.numberOfReplicas(), validation.indexFailures(indexMetaData.index()));

            for (IndexShardRoutingTable shardRoutingTable : indexRoutingTable) {
                ClusterShardHealth shardHealth = new ClusterShardHealth(shardRoutingTable.shardId().id());
                for (ShardRouting shardRouting : shardRoutingTable) {
                    if (shardRouting.active()) {
View Full Code Here

Examples of org.elasticsearch.cluster.metadata.IndexMetaData.numberOfShards()

            validation.addIndexFailure(index(), "Exists in routing does not exists in metadata");
            return;
        }
        IndexMetaData indexMetaData = metaData.index(index());
        // check the number of shards
        if (indexMetaData.numberOfShards() != shards().size()) {
            Set<Integer> expected = Sets.newHashSet();
            for (int i = 0; i < indexMetaData.numberOfShards(); i++) {
                expected.add(i);
            }
            for (IndexShardRoutingTable indexShardRoutingTable : this) {
View Full Code Here

Examples of org.elasticsearch.cluster.metadata.IndexMetaData.numberOfShards()

        }
        IndexMetaData indexMetaData = metaData.index(index());
        // check the number of shards
        if (indexMetaData.numberOfShards() != shards().size()) {
            Set<Integer> expected = Sets.newHashSet();
            for (int i = 0; i < indexMetaData.numberOfShards(); i++) {
                expected.add(i);
            }
            for (IndexShardRoutingTable indexShardRoutingTable : this) {
                expected.remove(indexShardRoutingTable.shardId().id());
            }
View Full Code Here

Examples of org.elasticsearch.cluster.metadata.IndexMetaData.numberOfShards()

        String path = getClass().getResource("/importdata/import_9").getPath();
        executeImportRequest("{\"directory\": \"" + path + "\", \"settings\": true}");

        ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest().filteredIndices("index1");
        IndexMetaData stats = esSetup.client().admin().cluster().state(clusterStateRequest).actionGet().getState().metaData().index("index1");
        assertEquals(2, stats.numberOfShards());
        assertEquals(1, stats.numberOfReplicas());
    }

    @Test
    public void testSettingsNotFound() {
View Full Code Here

Examples of org.elasticsearch.cluster.metadata.IndexMetaData.numberOfShards()

        ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest().filteredIndices("users");
        IndexMetaData metaData = esSetup.client().admin().cluster().state(clusterStateRequest).actionGet().getState().metaData().index("users");
        assertEquals("{\"d\":{\"properties\":{\"name\":{\"type\":\"string\",\"index\":\"not_analyzed\",\"store\":true,\"omit_norms\":true,\"index_options\":\"docs\"}}}}",
                metaData.mappings().get("d").source().toString());
        assertEquals(2, metaData.numberOfShards());
        assertEquals(0, metaData.numberOfReplicas());
    }


    private boolean existsWithField(String id, String field, String value, String index, String type) {
View Full Code Here

Examples of org.elasticsearch.cluster.metadata.IndexMetaData.numberOfShards()

            }
        } else {
            hash = hash(hashFunction, routing);
        }
        if (createdVersion.onOrAfter(Version.V_2_0_0)) {
            return MathUtils.mod(hash, indexMetaData.numberOfShards());
        } else {
            return Math.abs(hash % indexMetaData.numberOfShards());
        }
    }
View Full Code Here

Examples of org.elasticsearch.cluster.metadata.IndexMetaData.numberOfShards()

            hash = hash(hashFunction, routing);
        }
        if (createdVersion.onOrAfter(Version.V_2_0_0)) {
            return MathUtils.mod(hash, indexMetaData.numberOfShards());
        } else {
            return Math.abs(hash % indexMetaData.numberOfShards());
        }
    }

    protected int hash(HashFunction hashFunction, String routing) {
        return hashFunction.hash(routing);
View Full Code Here

Examples of org.elasticsearch.cluster.metadata.IndexMetaData.numberOfShards()

        for (IndexMetaData original : latestMetaData) {
            IndexMetaData deserialized = indices.get(original.getIndex());
            assertThat(deserialized, notNullValue());
            assertThat(deserialized.version(), equalTo(original.version()));
            assertThat(deserialized.numberOfReplicas(), equalTo(original.numberOfReplicas()));
            assertThat(deserialized.numberOfShards(), equalTo(original.numberOfShards()));
        }

        // now corrupt all the latest ones and make sure we fail to load the state
        if (numStates > numLegacy) {
            for (int i = 0; i < dirs.length; i++) {
View Full Code Here

Examples of org.elasticsearch.cluster.metadata.IndexMetaData.numberOfShards()

                    MetaData newMetaData = MetaData.builder(currentState.metaData())
                            .put(indexMetaData, false)
                            .build();

                    logger.info("[{}] creating index, cause [{}], shards [{}]/[{}], mappings {}", request.index(), request.cause(), indexMetaData.numberOfShards(), indexMetaData.numberOfReplicas(), mappings.keySet());

                    ClusterBlocks.Builder blocks = ClusterBlocks.builder().blocks(currentState.blocks());
                    if (!request.blocks().isEmpty()) {
                        for (ClusterBlock block : request.blocks()) {
                            blocks.addIndexBlock(request.index(), block);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.