Class RoutingTable

    • Field Detail

      • EMPTY_ROUTING_TABLE

        public static final RoutingTable EMPTY_ROUTING_TABLE
    • Method Detail

      • hasIndex

        public boolean hasIndex​(java.lang.String index)
      • hasIndex

        public boolean hasIndex​(Index index)
      • shardRoutingTable

        public IndexShardRoutingTable shardRoutingTable​(java.lang.String index,
                                                        int shardId)
        All shards for the provided index and shard id
        Returns:
        All the shard routing entries for the given index and shard id
        Throws:
        IndexNotFoundException - if provided index does not exist
        ShardNotFoundException - if provided shard id is unknown
      • validate

        public boolean validate​(MetaData metaData)
      • allShards

        public java.util.List<ShardRouting> allShards()
        All the shards (replicas) for all indices in this routing table.
        Returns:
        All the shards
      • allShards

        public java.util.List<ShardRouting> allShards​(java.lang.String index)
        All the shards (replicas) for the provided index.
        Parameters:
        index - The index to return all the shards (replicas).
        Returns:
        All the shards matching the specific index
        Throws:
        IndexNotFoundException - If the index passed does not exists
      • allActiveShardsGrouped

        public GroupShardsIterator allActiveShardsGrouped​(java.lang.String[] indices,
                                                          boolean includeEmpty)
      • allActiveShardsGrouped

        public GroupShardsIterator allActiveShardsGrouped​(java.lang.String[] indices,
                                                          boolean includeEmpty,
                                                          boolean includeRelocationTargets)
        Return GroupShardsIterator where each active shard routing has it's own shard iterator.
        Parameters:
        includeEmpty - if true, a shard iterator will be added for non-assigned shards as well
        includeRelocationTargets - if true, an extra shard iterator will be added for relocating shards. The extra iterator contains a single ShardRouting pointing at the relocating target
      • allAssignedShardsGrouped

        public GroupShardsIterator<ShardIterator> allAssignedShardsGrouped​(java.lang.String[] indices,
                                                                           boolean includeEmpty,
                                                                           boolean includeRelocationTargets)
        Return GroupShardsIterator where each assigned shard routing has it's own shard iterator.
        Parameters:
        includeEmpty - if true, a shard iterator will be added for non-assigned shards as well
        includeRelocationTargets - if true, an extra shard iterator will be added for relocating shards. The extra iterator contains a single ShardRouting pointing at the relocating target
      • allShards

        public ShardsIterator allShards​(java.lang.String[] indices)
      • allShardsIncludingRelocationTargets

        public ShardsIterator allShardsIncludingRelocationTargets​(java.lang.String[] indices)
      • activePrimaryShardsGrouped

        public GroupShardsIterator<ShardIterator> activePrimaryShardsGrouped​(java.lang.String[] indices,
                                                                             boolean includeEmpty)
        All the *active* primary shards for the provided indices grouped (each group is a single element, consisting of the primary shard). This is handy for components that expect to get group iterators, but still want in some cases to iterate over all primary shards (and not just one shard in replication group).
        Parameters:
        indices - The indices to return all the shards (replicas)
        Returns:
        All the primary shards grouped into a single shard element group each
        Throws:
        IndexNotFoundException - If an index passed does not exists
      • readDiffFrom

        public static Diff<RoutingTable> readDiffFrom​(StreamInput in)
                                               throws java.io.IOException
        Throws:
        java.io.IOException
      • readFrom

        public static RoutingTable readFrom​(StreamInput in)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object