使用 JAVA 中的日期数学表达式删除弹性搜索上超过 30 天的基于时间的索引给出 indexNotExists 异常

delete time based indices on elastic search older than 30 days using date math expression in JAVA gives indexNotExists exception

想要在 JAVA.

中使用日期数学表达式删除弹性搜索上早于某些特定(比如 30)天的基于时间的索引

Trying to implement following approach in our spring boot application using Transaport Client but getting index not exist exception.
https://www.elastic.co/guide/en/elasticsearch/reference/current/date-math-index-names.html

当相同的URI编码索引名称(传递给DELETE INDEX API)在kibana上使用查询GET uri_encoded_index_name搜索索引时,表明索引存在。

有什么我遗漏的吗?
有没有更好的方法可以在不使用策展人和通配符的情况下做到这一点?

代码段:

String indexName = "<" + indexNameStaticPart + "{now/d-30d{MMddYYYY}}>";     
String encodedIndexName = UriEncoder.encode( indexName ).replace( "/", "%2F" );      
AcknowledgedResponse response = client.admin().indices().delete( new DeleteIndexRequest( encodedIndexName ) ).actionGet();

编码索引名称:%3Cstring__string_string__%7Bnow%2Fd-30d%7BMMddyyyy%7D%7D%3E

基巴纳:

GET encodedIndexName 
DELETE encodedIndexName 

试试不用 URI 编码..

https://discuss.elastic.co/t/delete-time-based-indices-on-elastic-search-older-than-30-days-using-date-math-expression-in-java-gives-indexnotexists-exception/171365