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

版本: 6.8-7.15

简而言之,当Elasticsearch由于错误的文件夹结构而无法识别分片ID时,会出现此错误。这可能是由于手动更改数据目录或迁移失败造成的。要解决此问题,请确保数据目录结构符合Elasticsearch的预期。如果尝试了迁移,请重试并确保正确遵循所有步骤。如果问题仍然存在,请考虑从备份恢复。请务必记住,在进行重大更改之前备份您的数据,以防止数据丢失。

日志上下文 #

日志"Unable to resolve shard id. Wrong folder structure at [“的类名是 RemoveCorruptedShardDataCommand.java。我们从Elasticsearch源代码中提取了以下内容,供寻求深入上下文的人使用:

indexMetadata = StreamSupport.stream(clusterState.metadata().indices().values().spliterator(), false)
    .map(imd -> imd.value)
    .filter(imd -> imd.getIndexUUID().equals(indexUUIDFolderName)).findFirst()
    .orElse(null);
} else {
    throw new ElasticsearchException("Unable to resolve shard id. Wrong folder structure at [ " + path.toString()
        + " ]; expected .../nodes/[NODE-ID]/indices/[INDEX-UUID]/[SHARD-ID]");
}
} else {
    // otherwise resolve shardPath based on the index name and shard id
    String indexName = Objects.requireNonNull(indexNameOption.value(options), "Index name is required");