Skip to content
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

Can we relax the validation in ClusterRerouteService (not a bug)? #1560

Closed
jsjtzyy opened this issue Dec 13, 2021 · 1 comment
Closed

Can we relax the validation in ClusterRerouteService (not a bug)? #1560

jsjtzyy opened this issue Dec 13, 2021 · 1 comment
Milestone

Comments

@jsjtzyy
Copy link

jsjtzyy commented Dec 13, 2021

Please use the following questions as a guideline to help me answer
your issue/question without further inquiry. Thank you.

Which version of Elastic are you using?

[ *] elastic.v7 (for Elasticsearch 7.x)
[ ] elastic.v6 (for Elasticsearch 6.x)
[ ] elastic.v5 (for Elasticsearch 5.x)
[ ] elastic.v3 (for Elasticsearch 2.x)
[ ] elastic.v2 (for Elasticsearch 1.x)

Please describe the expected behavior

I was trying to call RetryFailed in ClusterRerouteService to retry on failed allocation in ES cluster. The code is quite simple (see below)

_, err := m.Client.ClusterReroute().RetryFailed(true).MasterTimeout(m.MasterTimeout).Do(ctx)

I expected it to succeed even though there was no request body or commands.

Please describe the actual behavior

Got missing allocate commands or raw body coming from here:

if err := s.Validate(); err != nil {

Any steps to reproduce the behavior?

I did this on Kibana and succeeded, so I wonder if we can relax the validation to accommodate simply retry_failed case?

POST _cluster/reroute?retry_failed
@olivere olivere added this to the 7.0.31 milestone Jan 7, 2022
@olivere
Copy link
Owner

olivere commented Jan 7, 2022

Hi! That does work, but I suspect this to be a problem with ES. It probably is a nop, i.e. it doesn't do anything in ES.

The documentation clearly states that the request body is required (see here). So I think it's good to warn users if they forgot to add a request body. Otherwise they think everything is OK while it really isn't (because ES just swallowed the error).

@olivere olivere closed this as completed Jan 7, 2022
olivere added a commit that referenced this issue Jan 7, 2022
This commit adds some more tests to the Cluster Reroute API, while
revisiting #1560.

Close #1560
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants