Add warning for Elasticsearch index analyzers mismatch (#34515)

This commit is contained in:
Claire 2025-04-25 12:35:11 +02:00 committed by GitHub
parent 1326c8cb1d
commit 7a70d95435
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 0 deletions

View File

@ -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

View File

@ -903,6 +903,8 @@ en:
system_checks:
database_schema_check:
message_html: There are pending database migrations. Please run them to ensure the application behaves as expected
elasticsearch_analysis_index_mismatch:
message_html: Elasticsearch index analyzer settings are outdated. Please run <code>tootctl search deploy --only-mapping --only=%{value}</code>
elasticsearch_health_red:
message_html: Elasticsearch cluster is unhealthy (red status), search features are unavailable
elasticsearch_health_yellow: