Class DeprecatedIndexPredicate

java.lang.Object
org.elasticsearch.xpack.core.deprecation.DeprecatedIndexPredicate

public class DeprecatedIndexPredicate extends Object
  • Field Details

    • MINIMUM_WRITEABLE_VERSION_AFTER_UPGRADE

      public static final IndexVersion MINIMUM_WRITEABLE_VERSION_AFTER_UPGRADE
  • Constructor Details

    • DeprecatedIndexPredicate

      public DeprecatedIndexPredicate()
  • Method Details

    • getReindexRequiredPredicate

      public static Predicate<Index> getReindexRequiredPredicate(ProjectMetadata metadata, boolean filterToBlockedStatus, boolean includeSystem)
      This predicate allows through only indices that were created with a previous lucene version, meaning that they need to be reindexed in order to be writable in the _next_ lucene version. It excludes searchable snapshots as they are not writable. It ignores searchable snapshots as they are not writable.
      Parameters:
      metadata - the cluster metadata
      filterToBlockedStatus - if true, only indices that are write blocked will be returned, if false, only those without a block are returned
      includeSystem - if true, all indices including system will be returned, if false, only non-system indices are returned
      Returns:
      a predicate that returns true for indices that need to be reindexed
    • reindexRequired

      public static boolean reindexRequired(IndexMetadata indexMetadata, boolean filterToBlockedStatus, boolean includeSystem)
      This method check if the indices that were created with a previous lucene version, meaning that they need to be reindexed in order to be writable in the _next_ lucene version. It excludes searchable snapshots as they are not writable.
      Parameters:
      indexMetadata - the index metadata
      filterToBlockedStatus - if true, only indices that are write blocked will be returned, if false, only those without a block are returned
      includeSystem - if true, all indices including system will be returned, if false, only non-system indices are returned
      Returns:
      returns true for indices that need to be reindexed
    • reindexRequiredForTransportVersion

      public static boolean reindexRequiredForTransportVersion(IndexMetadata indexMetadata, boolean filterToBlockedStatus, boolean includeSystem)
      This method checks if this index is on the current transport version for the current minor release version.
      Parameters:
      indexMetadata - the index metadata
      filterToBlockedStatus - if true, only indices that are write blocked will be returned, if false, only those without a block are returned
      includeSystem - if true, all indices including system will be returned, if false, only non-system indices are returned
      Returns:
      returns true for indices that need to be reindexed
    • reindexRequiredForPecolatorFields

      public static List<String> reindexRequiredForPecolatorFields(IndexMetadata indexMetadata, boolean filterToBlockedStatus, boolean includeSystem)
      This method checks if this index requires reindexing based on if it has percolator fields older than the current transport version for the current minor release.
      Parameters:
      indexMetadata - the index metadata
      filterToBlockedStatus - if true, only indices that are write blocked will be returned, if false, only those without a block are returned
      includeSystem - if true, all indices including system will be returned, if false, only non-system indices are returned
      Returns:
      returns a message as a string for each incompatible percolator field found
    • findInPropertiesRecursively

      public static List<String> findInPropertiesRecursively(String type, Map<String,Object> parentMap, Function<Map<?,?>,Boolean> predicate, BiFunction<String,Map.Entry<?,?>,String> fieldFormatter, String fieldBeginMarker, String fieldEndMarker)
      iterates through the "properties" field of mappings and returns any predicates that match in the form of issue-strings.
      Parameters:
      type - the document type
      parentMap - the mapping to read properties from
      predicate - the predicate to check against for issues, issue is returned if predicate evaluates to true
      fieldFormatter - a function that takes a type and mapping field entry and returns a formatted field representation
      Returns:
      a list of issues found in fields