go-elasticsearch
go-elasticsearch copied to clipboard
index name may be double escaped
In Elasticsearch, escaped characters may be contains in index name. ref: https://www.elastic.co/guide/en/elasticsearch/reference/current/date-math-index-names.html
# PUT /<my-index-{now/d}>
PUT /%3Cmy-index-%7Bnow%2Fd%7D%3E
Notice that we have to escape the /
here.
In Golang, paths are usually escaped automatically. However, /
is not an escaped character.
If we specify an escaped index name, it will be double escaped.
So, the library is currently not possible to use this index.
Solution: https://github.com/soranoba/go-elasticsearch/compare/master..fix/master/double-escape-path
The code will solve the problem, but what was previously escaped will no longer be escaped. It may be a breaking change.
Is there a better solution?
Related issues: https://github.com/elastic/go-elasticsearch/issues/52
Hello, sorry for the delay here. Correct, there's an inconsistency with regard to the /
character, due to the behaviour of URL escaping in Go. As I wrote in the related issue comment, and as you mention, this is tricky to solve without breaking backwards compatibility. I imagine this is something worth looking before releasing the 8.0 version of the package.
Thank you for your reply. I hope that it fixes in 8.0.