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

版本: 6.8-7.1

简而言之,当Elasticsearch在集群状态完全恢复之前尝试写入安全索引时,就会发生此错误。这可能是由于恢复过程缓慢或过早的写入尝试导致的。要解决此问题,您可以等待集群状态完全恢复后再尝试写入安全索引,或者手动强制进行集群状态恢复。此外,确保您的Elasticsearch节点拥有足够的资源,以避免恢复时间过长。

日志上下文 #

日志"Cluster state has not been recovered yet; cannot write to the security index"的类名是 SecurityIndexManager.java。我们从Elasticsearch源代码中提取了以下内容,供那些需要深入了解上下文的人参考:

*/
 public void prepareIndexIfNeededThenExecute(final Consumerconsumer; final Runnable andThen) {
 final State indexState = this.indexState; // use a local copy so all checks execute against the same state!
 // TODO we should improve this so we don't fire off a bunch of requests to do the same thing (create or update mappings)
 if (indexState == State.UNRECOVERED_STATE) {
 consumer.accept(new ElasticsearchStatusException("Cluster state has not been recovered yet; cannot write to the security index";
 RestStatus.SERVICE_UNAVAILABLE));
 } else if (indexState.indexExists && indexState.isIndexUpToDate == false) {
 consumer.accept(new IllegalStateException(
 "Security index is not on the current version. Security features relying on the index will not be available until " +
 "the upgrade API is run on the security index"));