栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

Elasticsearch - no write index is defined for alias [log]报错原因以及解决就办法

Elasticsearch - no write index is defined for alias [log]报错原因以及解决就办法

文章目录
    • 前言
    • 原因分析
    • 解决方法(二选一)
      • 1、指定具体索引名
      • 2、继续使用别名

转载请标明出处:
https://bigmaning.blog.csdn.net/article/details/121578814
本文出自:【BigManing的博客】

前言

执行es操作报错

no write index is defined for alias [log]. The write index may be explicitly disabled using is_write_index=false or the alias points to multiple indices without one being designated as a write index
原因分析

log 是自定义的索引别名,泛指符合log-*模式的索引,例如log-20211212 ,在搜索时可以不用指定具体的索引 ,方便全局搜索。

但是写入操作数据时 不用直接使用别名[log] ,否则就会报错(如上)

解决方法(二选一) 1、指定具体索引名

例如写入操作时,指定具体的索引名

2、继续使用别名

这种情况下,需要指定一个索引为可写,例如把log-20211212设置为可写索引。

POST /_aliases    
{    
    "actions" : [    
        {    
            "add" : {    
                 "index" : "log-20211212",    
                 "alias" : "log",    
                 "is_write_index" : true 
            }    
        }    
    ]    
}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/612405.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号