Package org.elasticsearch.gateway
Class PriorityComparator
java.lang.Object
org.elasticsearch.gateway.PriorityComparator
- All Implemented Interfaces:
Comparator<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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcompare(ShardRouting o1, ShardRouting o2)static PriorityComparatorgetAllocationComparator(RoutingAllocation allocation)Returns a PriorityComparator that uses the RoutingAllocation index metadata to access the index setting per index.protected abstract IndexMetadatagetMetadata(Index index)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
PriorityComparator
public PriorityComparator()
-
-
Method Details
-
compare
- Specified by:
comparein interfaceComparator<ShardRouting>
-
getMetadata
-
getAllocationComparator
Returns a PriorityComparator that uses the RoutingAllocation index metadata to access the index setting per index.
-