elastic4s icon indicating copy to clipboard operation
elastic4s copied to clipboard

`getIndex` doesn't support date math in index aliases

Open tastyminerals opened this issue 2 years ago • 1 comments

We are using date math when doing index rollover tasks and use the following string pattern "<index-{now/w{YYYY-ww}}-0001>". Looks like getIndex doesn't support date math in index names.

val resp = client.execute {
      getIndex("<index-{now/w{YYYY-ww}}-0001>")
}.await.result

Throws an exception

com.sksamuel.elastic4s.http.JavaClientExceptionWrapper: java.lang.IllegalArgumentException: Illegal character in path at index 1: /<index-{now/w{YYYY-ww}}-0001>

Index creation via createIndex works though.

tastyminerals avatar Feb 23 '24 18:02 tastyminerals

I think you need to percent encode your index name: https://www.elastic.co/guide/en/elasticsearch/reference/current/api-conventions.html#api-date-math-index-names.

Philippus avatar May 05 '24 19:05 Philippus