lyxbai opened a new issue, #6148:
URL: https://github.com/apache/shenyu/issues/6148

   ### Is there an existing issue for this?
   
   - [x] I have searched the existing issues
   
   ### Current Behavior
   
   问题定位:
   
   当前存在两个时间戳的shenyu-access-logging索引
   <img width="2904" height="214" alt="Image" 
src="https://github.com/user-attachments/assets/abf25dd2-a74a-4535-b8b7-cc0ad585fabc";
 />
   
   对shenyu写入索引的代码增加了写入es索引返回信息的打印,返回如下报错
   <img width="2842" height="1688" alt="Image" 
src="https://github.com/user-attachments/assets/f02d3d55-e363-4ce2-a191-b52904ce5e94";
 />
   ErrorCause: {"type":"illegal_argument_exception","reason":"no write index is 
defined for alias [shenyu-access-logging]. 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"}
   
   elk中documents也是0,证明了没有写入成功
   <img width="3336" height="1512" alt="Image" 
src="https://github.com/user-attachments/assets/be7a2d6c-7ddd-496e-8d66-a21297ed1222";
 />
   
   问题原因:
   <img width="2510" height="1394" alt="Image" 
src="https://github.com/user-attachments/assets/454da9d1-1977-4297-9309-1acb7234f52d";
 />
   bulk 里写入的是 别名 
shenyu-access-logging,这个别名指向了多个索引(shenyu-access-logging-2025-09-09、shenyu-access-logging-2025-09-11),Elasticsearch
 要求写入别名必须指定一个 write index
   
   修复代码:
   <img width="2860" height="1674" alt="Image" 
src="https://github.com/user-attachments/assets/b3a33035-e401-4aab-81c4-58445ccf6396";
 />
   
   修复后效果:
   <img width="2846" height="1674" alt="Image" 
src="https://github.com/user-attachments/assets/4bd3ffc7-2af7-411a-af66-ae5f001ef163";
 />
   <img width="3342" height="1740" alt="Image" 
src="https://github.com/user-attachments/assets/1c7e45b6-2f61-41bd-849d-b0629331e013";
 />
   <img width="3814" height="1848" alt="Image" 
src="https://github.com/user-attachments/assets/f6f81481-46f0-4b4d-a1b1-6c3342ac917f";
 />
   
   其他说明:
   如果使用现有代码,只有一个时间戳的shenyu-access-logging索引,写入索引数据不会失败
   比如下图中只有shenyu-access-logging-2025-09-09这一个索引时,数据能正常写入。
   <img width="3170" height="206" alt="Image" 
src="https://github.com/user-attachments/assets/9b277aab-f1f9-453c-b04b-6faeb4e2c96f";
 />
   <img width="3312" height="1266" alt="Image" 
src="https://github.com/user-attachments/assets/e04fe72c-e060-489f-98e4-3d32208aa2ed";
 />
   <img width="3808" height="1840" alt="Image" 
src="https://github.com/user-attachments/assets/600dfcd8-1660-4ffa-bbd3-1265ecddb0e0";
 />
   
   ### Expected Behavior
   
   _No response_
   
   ### Steps To Reproduce
   
   _No response_
   
   ### Environment
   
   ```markdown
   ShenYu version(s):2.7.0.2
   ```
   
   ### Debug logs
   
   _No response_
   
   ### Anything else?
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@shenyu.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to