From me, in a review:
For reference one correct way to do complex queries, which may be of some use in the long term but probably not desired right here right now, is to POST a query to be persisted on the server and then GET the uri returned in the location header. So you create a query and then use it again as many times as you like. For a metrics database that might be queried in various ways day in day out this would be a handy feature. If you wanted, it could be templatized (using uri-templates perhaps), with query string paramters setting the contents of the generated query.
The basic idea (names of routes and other entities subject to improvement) is to:
- POST to /queries with a JSON body containing the query to be saved.
- The Location header of the response (if request is successful) contains a URI.
- GET that URI at /queries/uuid to actually do the desired search.
- Consider ways to do template handling.
The benefits of this include:
- More HTTP-hygenic than the existing solution (
SEARCH
method ormethod=search
). - Design and forget complex queries rather than having to recreate them.
- Shareable queries.
- Long term allow cache-ability of query results (complex but interesting problem)