Fixes #2824 - Elasticsearch 7.5.x support.

This commit is contained in:
Martin Edenhofer 2019-12-04 10:52:54 +01:00 committed by Thorsten Eckel
parent 209951b19b
commit 3921820ae8

View file

@ -79,6 +79,18 @@ namespace :searchindex do
pipeline = "zammad#{rand(999_999_999_999)}" pipeline = "zammad#{rand(999_999_999_999)}"
Setting.set('es_pipeline', pipeline) Setting.set('es_pipeline', pipeline)
end end
# define pipeline_field_attributes
# ES 5.6 and nower has no ignore_missing support
pipeline_field_attributes = {
ignore_failure: true,
}
if es_multi_index?
pipeline_field_attributes = {
ignore_failure: true,
ignore_missing: true,
}
end
print 'create pipeline (pipeline)... ' print 'create pipeline (pipeline)... '
SearchIndexBackend.processors( SearchIndexBackend.processors(
"_ingest/pipeline/#{pipeline}": [ "_ingest/pipeline/#{pipeline}": [
@ -91,22 +103,19 @@ namespace :searchindex do
processors: [ processors: [
{ {
foreach: { foreach: {
field: 'article', field: 'article',
ignore_failure: true, processor: {
processor: {
foreach: { foreach: {
field: '_ingest._value.attachment', field: '_ingest._value.attachment',
ignore_failure: true, processor: {
processor: {
attachment: { attachment: {
target_field: '_ingest._value', target_field: '_ingest._value',
field: '_ingest._value._content', field: '_ingest._value._content',
ignore_failure: true, }.merge(pipeline_field_attributes),
}
} }
} }.merge(pipeline_field_attributes),
} }
} }.merge(pipeline_field_attributes),
} }
] ]
} }
@ -301,7 +310,7 @@ def es_pipeline?
true true
end end
# no mulit index for elasticsearch 5.6 and lower # no multi index for elasticsearch 5.6 and lower
def es_multi_index? def es_multi_index?
number = es_version number = es_version
return false if number.blank? return false if number.blank?