Closed
Description
What is the bug?
When creating a monitor, we first create a new monitor and index the document for it.
Following that, we check if the monitor is a document level monitor and try index document level queries in percolate search query index.
If the indexing fails we throw an exception and the request fails, but the monitor which has been created is not deleted.
This causes users of alerting plugin and plugins using alerting plugin to conclude that monitor creation has failed but there exists a monitor unknown to users, upstream plugins which fails on every single execution due to the same failure of indexing doc level queries