У меня есть шаблон с большим количеством полей, ниже приведен сокращенный образец.
{
"index_patterns": "test*",
"order": 2,
"version": 2,
"aliases": {
"tests": {
}
},
"settings": {
"number_of_shards": 5,
"analysis": {
"normalizer": {
"lowercase_normalizer": {
"type": "custom",
"char_filter": [
],
"filter": [
"lowercase"
]
}
}
}
},
"mappings": {
"dynamic": "false",
"properties": {
"id": {
"type": "keyword",
"normalizer": "lowercase_normalizer"
},
"emailAddress": {
"enabled": false
},
"createdTimestampEpochInMilliseconds": {
"type": "date",
"format": "epoch_millis"
},
"updatedTimestampEpochInMilliseconds": {
"type": "date",
"format": "epoch_millis"
},
"createdDate": {
"type": "date"
},
"updatedDate": {
"type": "date"
}
}
}
}
Поле emailAddress
установлено на enabled=false
, и у нас есть требование сделать его доступным для поиска, поэтому мы необходимо изменить шаблон и установить этот тип поля и нормализатор, как поле id
. Затем поместите шаблон и переиндексируйте данные из индекса test-2
в индекс test-4
.
{
"index_patterns": "test*",
"order": 4,
"version": 4,
"aliases": {
"tests": {
}
},
"settings": {
"number_of_shards": 5,
"analysis": {
"normalizer": {
"lowercase_normalizer": {
"type": "custom",
"char_filter": [
],
"filter": [
"lowercase"
]
}
}
}
},
"mappings": {
"dynamic": "false",
"properties": {
"id": {
"type": "keyword",
"normalizer": "lowercase_normalizer"
},
"emailAddress": {
"type": "keyword",
"normalizer": "lowercase_normalizer"
},
"createdTimestampEpochInMilliseconds": {
"type": "date",
"format": "epoch_millis"
},
"updatedTimestampEpochInMilliseconds": {
"type": "date",
"format": "epoch_millis"
},
"createdDate": {
"type": "date"
},
"updatedDate": {
"type": "date"
}
}
}
}
При попытке переиндексировать либо с помощью Elasti c Поиск ReindexOnServer
, либо вручную запрашивая данные и переходя от одного к другому Индекс к другому мы получаем 400 Bad Request
ошибка.
{
"index": "test-4",
"type": "_doc",
"id": "54e1ea11-d7b4-4310-90f1-11ddbecc4d21",
"cause": {
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [_doc]: Mapping definition for [emailAddress] has unsupported parameters: [enabled : false]",
"caused_by": {
"type": "mapper_parsing_exception",
"reason": "Mapping definition for [emailAddress] has unsupported parameters: [enabled : false]"
}
},
"status": 400
}
Сообщение об ошибке немного сбивает с толку, изменение версии шаблона должно автоматически создать индекс с использованием самого последнего шаблона и уважать новый тип индексации поля и нормализатор , Не уверен, что мне здесь не хватает.