Module org.elasticsearch.server
Enum Class SnapshotSortKey
java.lang.Object
java.lang.Enum<SnapshotSortKey>
org.elasticsearch.action.admin.cluster.snapshots.get.SnapshotSortKey
- All Implemented Interfaces:
Serializable,Comparable<SnapshotSortKey>,Constable
Sort key for snapshots e.g. returned from the get-snapshots API. All values break ties using
SnapshotInfo.snapshotId() (i.e. by
name).-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionSort by snapshot duration (end time minus start time).Sort by number of failed shards in the snapshot.Sort by number of indices in the snapshot.Sort by snapshot name.Sort by repository name.Sort by number of shards in the snapshot.Sort by snapshot start time. -
Method Summary
Modifier and TypeMethodDescriptionstatic SnapshotSortKey.AfterdecodeAfterQueryParam(String param) final StringencodeAfterQueryParam(SnapshotInfo snapshotInfo) final Predicate<SnapshotInfo> getAfterPredicate(SnapshotSortKey.After after, SortOrder sortOrder) final Comparator<SnapshotInfo> getSnapshotInfoComparator(SortOrder sortOrder) protected abstract StringgetSortKeyValue(SnapshotInfo snapshotInfo) protected abstract Predicate<SnapshotInfo> innerGetAfterPredicate(SnapshotSortKey.After after, SortOrder sortOrder) static SnapshotSortKeytoString()static SnapshotSortKeyReturns the enum constant of this class with the specified name.static SnapshotSortKey[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
START_TIME
Sort by snapshot start time. -
NAME
Sort by snapshot name. -
DURATION
Sort by snapshot duration (end time minus start time). -
INDICES
Sort by number of indices in the snapshot. -
SHARDS
Sort by number of shards in the snapshot. -
FAILED_SHARDS
Sort by number of failed shards in the snapshot. -
REPOSITORY
Sort by repository name.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
toString
- Overrides:
toStringin classEnum<SnapshotSortKey>
-
getSnapshotInfoComparator
- Returns:
- a
Comparatorwhich sortsSnapshotInfoinstances according to this sort key.
-
decodeAfterQueryParam
- Returns:
- an
SnapshotSortKey.Afterwhich can be included in aGetSnapshotsRequest(e.g. to be sent to a remote node) and ultimately converted into a predicate to filter outSnapshotInfoitems which were returned on earlier pages of results. See alsoencodeAfterQueryParam(org.elasticsearch.snapshots.SnapshotInfo)andgetAfterPredicate(org.elasticsearch.action.admin.cluster.snapshots.get.SnapshotSortKey.After, org.elasticsearch.search.sort.SortOrder).
-
encodeAfterQueryParam
- Returns:
- an encoded representation of the value of the sort key for the given
SnapshotInfo, including the values of the snapshot name and repo name for tiebreaking purposes, which can be returned to the user so they can pass it back to the?afterparam of a subsequent call to the get-snapshots API in order to retrieve the next page of results.
-
getSortKeyValue
- Returns:
- a string representation of the value of the sort key for the given
SnapshotInfo, which should be the last item in the response, which is combined with the snapshot and repository names, encoded, and returned to the user so they can pass it back to the?afterparam of a subsequent call to the get-snapshots API in order to retrieve the next page of results.
-
getAfterPredicate
public final Predicate<SnapshotInfo> getAfterPredicate(@Nullable SnapshotSortKey.After after, SortOrder sortOrder) - Returns:
- a predicate to filter out
SnapshotInfoitems that match the user's query but which sort earlier than the givenSnapshotSortKey.Aftervalue (i.e. they were returned on earlier pages of results). Ifafterisnullthen the returned predicate matches all snapshots.
-
innerGetAfterPredicate
protected abstract Predicate<SnapshotInfo> innerGetAfterPredicate(SnapshotSortKey.After after, SortOrder sortOrder) - Returns:
- a predicate to filter out
SnapshotInfoitems that match the user's query but which sort earlier than the givenSnapshotSortKey.Aftervalue (i.e. they were returned on earlier pages of results). Theafterparameter is notnull.
-
of
-