📣 极限科技诚招搜索运维工程师(Elasticsearch/Easysearch)- 全职/北京 👉 : 立即申请加入

版本: 6.8-8.9

简而言之,当尝试更新已设置为只读或已关闭的索引的映射时,会出现此错误。Elasticsearch 在这种情况下不允许映射更新。要解决此问题,您可以使用 Elasticsearch API 将索引设置回读写模式,或重新打开已关闭的索引。此外,请确保在索引变为只读或关闭之前进行映射更改。

日志上下文 #

日志 “mapping updates are not allowed [” + operation + “]” 的类名是 RecoveryTarget.java。 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人使用:

*/
    indexShard().updateRetentionLeasesOnReplica(retentionLeases);
    for (Translog.Operation operation : operations) {
        Engine.Result result = indexShard().applyTranslogOperation(operation; Engine.Operation.Origin.PEER_RECOVERY);
        if (result.getResultType() == Engine.Result.Type.MAPPING_UPDATE_REQUIRED) {
            throw new MapperException("mapping updates are not allowed [" + operation + "]");
        }
        if (result.getFailure() != null) {
            if (Assertions.ENABLED && result.getFailure() instanceof MapperException == false) {
                throw new AssertionError("unexpected failure while replicating translog entry"; result.getFailure());
            }