-
Notifications
You must be signed in to change notification settings - Fork 626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid time duration formatting #25
Labels
Comments
Thanks for the report, @andrewkroh! I was expecting to hit this problem in time, and was aware that the conversion in that spot is too naïve. I'll have a look into that soon. And yes, documentation on the generator is a good idea — when the setup is right, |
andrewkroh
added a commit
to andrewkroh/go-elasticsearch
that referenced
this issue
Feb 27, 2019
The scroll time was being formatted based on the Go time.Duration format. So for one minute it would use 16666h40m0s. Elasticsearch supports nanoseconds as a time unit so so it can pass the Go time.Duration value through without any conversion just by appending "nanos". Fixes elastic#25
andrewkroh
added a commit
to andrewkroh/go-elasticsearch
that referenced
this issue
Feb 27, 2019
The scroll time was being formatted based on the Go time.Duration format. So for one minute it would use 16666h40m0s. Elasticsearch supports nanoseconds as a time unit so so it can pass the Go time.Duration value through without any conversion just by appending "nanos". This updates the generator but doesn't regenerate the API sources. Fixes elastic#25
karmi
added a commit
that referenced
this issue
Mar 16, 2019
This patch adds a helper method, `formatDuration()`, which properly converts a Go `time.Duration` value into the format accepted by Elasticsearch time units; see: https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#time-units. The generated code will use the function like this: if r.Timeout != 0 { params["timeout"] = formatDuration(r.Timeout) } Related: #27, #25
karmi
added a commit
that referenced
this issue
Mar 24, 2019
This patch adds a helper method, `formatDuration()`, which properly converts a Go `time.Duration` value into the format accepted by Elasticsearch time units; see: https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#time-units. The generated code will use the function like this: if r.Timeout != 0 { params["timeout"] = formatDuration(r.Timeout) } Related: #27, #25
karmi
added a commit
that referenced
this issue
Mar 25, 2019
This patch adds a helper method, `formatDuration()`, which properly converts a Go `time.Duration` value into the format accepted by Elasticsearch time units; see: https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#time-units. The generated code will use the function like this: if r.Timeout != 0 { params["timeout"] = formatDuration(r.Timeout) } An integration test has been added as well. Related: #27, #25 Closes: #36
karmi
added a commit
that referenced
this issue
Mar 25, 2019
This patch adds a helper method, `formatDuration()`, which properly converts a Go `time.Duration` value into the format accepted by Elasticsearch time units; see: https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#time-units. The generated code will use the function like this: if r.Timeout != 0 { params["timeout"] = formatDuration(r.Timeout) } An integration test has been added as well. Related: #27, #25 Closes: #36
karmi
added a commit
that referenced
this issue
Mar 25, 2019
This patch adds a helper method, `formatDuration()`, which properly converts a Go `time.Duration` value into the format accepted by Elasticsearch time units; see: https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#time-units. The generated code will use the function like this: if r.Timeout != 0 { params["timeout"] = formatDuration(r.Timeout) } An integration test has been added as well. Related: #27, #25 Closes: #36 (cherry picked from commit c7dbbb6)
karmi
added a commit
that referenced
this issue
Mar 25, 2019
This patch adds a helper method, `formatDuration()`, which properly converts a Go `time.Duration` value into the format accepted by Elasticsearch time units; see: https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#time-units. The generated code will use the function like this: if r.Timeout != 0 { params["timeout"] = formatDuration(r.Timeout) } An integration test has been added as well. Related: #27, #25 Closes: #36 (cherry picked from commit c7dbbb6)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was trying to do a scroll query and hit an issue caused by the formatting of time durations that are passed to Elasticsearch. You can see and example in:
https://play.golang.org/p/fKd7ErkUTJB
I tracked down the line in the generator but I wasn't exactly sure how to regenerate the source. (I think this would be a good topic for the readme or maybe a contributing doc.)
The scroll time was being formatted based on the Go time.Duration format. So for one minute it would use 16666h40m0s. Elasticsearch supports nanoseconds as a time unit so it can pass the Go time.Duration value through without any conversion just by appending "nanos".
The text was updated successfully, but these errors were encountered: