Add warning for Elasticsearch index analyzers mismatch (#34515)
This commit is contained in:
		@@ -38,6 +38,11 @@ class Admin::SystemCheck::ElasticsearchCheck < Admin::SystemCheck::BaseCheck
 | 
			
		||||
        :elasticsearch_index_mismatch,
 | 
			
		||||
        mismatched_indexes.join(' ')
 | 
			
		||||
      )
 | 
			
		||||
    elsif !specifications_match?
 | 
			
		||||
      Admin::SystemCheck::Message.new(
 | 
			
		||||
        :elasticsearch_analysis_mismatch,
 | 
			
		||||
        mismatched_specifications_indexes.join(' ')
 | 
			
		||||
      )
 | 
			
		||||
    elsif cluster_health['status'] == 'red'
 | 
			
		||||
      Admin::SystemCheck::Message.new(:elasticsearch_health_red)
 | 
			
		||||
    elsif cluster_health['number_of_nodes'] < 2 && es_preset != 'single_node_cluster'
 | 
			
		||||
@@ -111,10 +116,20 @@ class Admin::SystemCheck::ElasticsearchCheck < Admin::SystemCheck::BaseCheck
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def mismatched_specifications_indexes
 | 
			
		||||
    @mismatched_specifications_indexes ||= INDEXES.filter_map do |klass|
 | 
			
		||||
      klass.base_name if klass.specification.changed?
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def indexes_match?
 | 
			
		||||
    mismatched_indexes.empty?
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def specifications_match?
 | 
			
		||||
    mismatched_specifications_indexes.empty?
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def es_preset
 | 
			
		||||
    ENV.fetch('ES_PRESET', 'single_node_cluster')
 | 
			
		||||
  end
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user