opensearch-project / opensearch-project/alerting
[BUG] Alerting not honouring PUT method
@adityaj1107 is already working on this.
Since Jun 8, 2021.
- Dominant language
- Kotlin
- Stars
- 82
- Forks
- 133
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 9
Description
Issue by thenom
Friday Jul 17, 2020 at 15:33 GMT
Originally opened as https://github.com/opendistro-for-elasticsearch/alerting/issues/228
Describe the bug
Cannot PUT a new monitor with a specified ID for a non-existant monitor:
PUT _opendistro/_alerting/monitors/flibble
{
"type": "monitor",
"name": "flibble",
"enabled": true,
"schedule": {
"period": {
"interval": 10,
"unit": "MINUTES"
}
...
Results in:
{
"Message" : "Monitor with flibble is not found"
} {
"_index" : ".opendistro-alerting-config",
"_type" : "_doc",
"_id" : "flibble",
"found" : false
}
Is there any reason for this as this means that a search is required before hand to find if it exists in the cluster and then to perform a second call (either POST or PUT) based on the results of the search. I am just in the process of setting up OpenDistro so not sure if this issue appears elsewhere.
https://tools.ietf.org/html/rfc2616#section-9.6
If the Request-URI does not point to an existing resource, and that URI is
capable of being defined as a new resource by the requesting user
agent, the origin server can create the resource with that URI.
If this method was allowed as stated then this would remove that extra step in automation and you could just overwrite the monitor. I initially thought this might have been to inject the additional fields that appear in the monitor after the initial POST but this cant be the case because you still inject those fields during subsequent PUT operations when providing an existing _id.
Thanks,
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.