{{ ElasticsearchQueries.fromJson }} expects JSON like this:
{code} { 'query': <the query> } {code}
... instead of just the query. Providing different JSON will result in ` {{ ElasticsearchHSQuery ` }} generating invalid JSON.
But the fact we force users to provide the " \ {query: ... }" wrapping will probably make them think they *can* provide other parameters that are specific to the search API, such as "from"/"size", "sort" "explain", "inner hits", and so on.
We should either:
* change the contract for this method and expect the actual query JSON * keep the " \ {query: ... }" wrapping and throw exception when there is any other root-level property * keep the " \ {query: ... }" wrapping and only allow a select few options (custom aggregations in particular), throwing an exception for others |
|