-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Feature request: HEAD /_ilm/policy/{name} #50031
Comments
Pinging @elastic/es-core-features (:Core/Features/ILM+SLM) |
can I take this issue? |
Certainly, let me know if you have any questions.
…On Sat, Jan 11, 2020 at 4:22 AM Bogdan Sukonnov ***@***.***> wrote:
can I take this issue?
|
I would expect a 200 response if the policy exists, a 404 if it does not (with no body for either). |
@dakrone thanks, that I can do. What I am struggling to figure out is how to response with 404 without exception. Only way I find to response with 404 is to call |
@BogdanSukonnov sorry, I misunderstood what you were asking. I tested this locally, and all that is actually needed is to add the line: controller.registerHandler(RestRequest.Method.HEAD, "/_ilm/policy/{name}", this); And that's it. ES will automatically handle the response elision for you. So it'd just be this line and then a test for the functionality. |
@dakrone it's great! Thanks! I'll try. Can't believe this is so simple :) |
@dakrone OK, it's not so simple. It's maybe easy to get 404 response like always, when endpoint is not properly registered. But as soon as I implemented all necessary classes to receive 200 response for existing policy, the only way to answer with 404 for non-existing policy is to throw a ResourceNotFoundException exception. That lead to dirty logs, and it is not a desirable result in terms of this issue. |
No, unfortunately, it's not working, too. Looks that I can't solve this issue. |
I think a |
@DaveCTurner thanks, but this behavior is already implemented for Get method. Is there any point to do basically the same just to have another HTTP method? |
That question is best directed back at @ruflin. Nicolas, Additionally, checking whether the policy exists and then creating it is racy: someone else might create the policy in between those two calls. Do you need the ability to atomically |
What I expected is the same behaviour as with the index API. When I use I'm not really concerned here about the race condition part. |
Ok, thanks for the clarification. TBH it's a bit strange that |
Addressed by #51459. |
In elastic/kibana#52632 we check if an ILM policy already exist to make sure we don't overwrite it. Our initial implementation to do this check was:
The problem with the above is that it throws an exception on the Elasticsearch side which I don't like as I only want to check if it is there. The current solution I was pointed to, to work around this is using the following:
What I would prefer to see is heaving a HEAD request for this as we have in other API's:
The text was updated successfully, but these errors were encountered: