Package org.elasticsearch.gateway
Class PriorityComparator
org.elasticsearch.gateway.PriorityComparator
- All Implemented Interfaces:
<ShardRouting>
A comparator that compares
ShardRouting
instances based on various properties. Instances
are ordered as follows.
- First, system indices are ordered before non-system indices
- Then indices are ordered by their priority, in descending order (index.priority)
- Then newer indices are ordered before older indices, based on their creation date. This benefits time-series indices, where newer indices are considered more urgent (index.creation_date)
- Lastly the index names are compared, which is useful when a date is baked into the index
name, e.g.
logstash-2015.05.03
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
compare(ShardRouting o1, ShardRouting o2)
static PriorityComparator
getAllocationComparator(RoutingAllocation allocation)
Returns a PriorityComparator that uses the RoutingAllocation index metadata to access the index setting per index.protected abstract IndexMetadata
getMetadata(Index index)
Methods inherited from class java.lang.
, , , , , , , , , ,
Methods inherited from interface java.util.
, , , , , , ,
-
Constructor Details
-
PriorityComparator
public PriorityComparator()
-
-
Method Details
-
compare
- Specified by:
in interface
<ShardRouting>
-
getMetadata
-
getAllocationComparator
Returns a PriorityComparator that uses the RoutingAllocation index metadata to access the index setting per index.
-