Disabling Instant Results should deactivate search API #2794
Description
Is your enhancement related to a problem? Please describe.
When using ElasticPress.io, activating Instant Results saves a 'search template' to EP.io which enables the publicly accessible search API that powers Instant Results for the user's posts index. However when Instant Results is deactivated the search template is not removed, the the API remains active.
Describe the solution you'd like
Ideally deactivating Instant Results should delete the search template, thus deactivating the API for the user's posts index.
I believe the API already supports a DELETE request to remove the search template, so this should just be a matter of firing off that request when Instant Results is deactivated.
It's conceivable that a user may want to use the API while not using Instant Results, but if we want to support this then it can probably be sufficiently achieved by just enabling Instant Results and dequeueing the script.
Activity