-
Notifications
You must be signed in to change notification settings - Fork 102
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
[GUIDE] Add bulk guide #292
Conversation
You're missing DCO, same as other PRs. |
4754a8d
to
5d0023f
Compare
Signed-off-by: Rakhat Zhuman <zhumanrakhat01@gmail.com>
Signed-off-by: Rakhat Zhuman <zhumanrakhat01@gmail.com>
…ensearch-project#286) Signed-off-by: Jakob Hahn <jakob.hahn@hetzner.com> Signed-off-by: Rakhat Zhuman <zhumanrakhat01@gmail.com>
5d0023f
to
44ef010
Compare
fixed |
func main() { | ||
client, err := opensearch.NewDefaultClient() | ||
if err != nil { | ||
log.Printf("error occurred: [%s]", err.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we bailing here in samples, e.g. log.Fatalf
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was guided by the rules from issue, there was written not to throw errors, or did I misunderstand?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, I don't know what's best.
What's the user experience when NewDefaultClient()
returns an error with the code as written?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the console there will be a reason why the client was not created and the program will complete successfully, I mean there will be no fatal termination. The user, having read the reason, understands that he did something wrong, and decides the origin reason and tries again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this example the code doesn't do anything else, however in the example below:
movies := "movies"
books := "books"
createMovieIndex, err := client.Indices.Create(movies)
if err != nil {
log.Printf("error occurred: [%s]", err.Error())
}
log.Printf("response: [%+v]", createMovieIndex)
createBooksIndex, err := client.Indices.Create(books)
if err != nil {
log.Printf("error occurred: [%s]", err.Error())
}
log.Printf("response: [%+v]", createBooksIndex)
You get an error the first time on client.Indices.Create(movies)
, then you get an error again the second time on client.Indices.Create(books)
. I believe we shouldn't be bailing after the first error, no? Furthermore, there should be a way to auto-cleanup whatever was successfully created even if it was only the first and not the second index.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree about the first one, but again I will refer to the guide ... It's not difficult for me to change it for a fatal mistake. At the expense of the second, at the end of each guide there are cleaning topics, and the previously created modules were cleaned there
Description
Add bulk guide.
Issues Resolved
Closes [#278, #279].
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.