Render Search Application Query

edit

This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.

Given specified query parameters, creates an Elasticsearch query to run. Any unspecified template parameters will be assigned their default values if applicable. Returns the specific Elasticsearch query that would be generated and run by calling search application search.

Request

edit

POST _application/search_application/<name>/_render_query

Prerequisites

edit

Requires read privileges on the backing alias of the search application.

Request body

edit
params
(Optional, map of strings to objects) Query parameters specific to this request, which will override any defaults specified in the template.

Response codes

edit
404
Search Application <name> does not exist.

Examples

edit

The following example renders a query for a search application called my-app. In this case, the from and size parameters are not specified, so default values are pulled from the search application template.

POST _application/search_application/my-app/_render_query
{
  "params": {
    "value": "my first query",
    "text_fields": [
        {
            "name": "title",
            "boost": 10
        },
        {
            "name": "text",
            "boost": 1
        }
    ]
  }
}

A sample response:

{
    "size": 10,
    "from": 0,
    "query": {
        "multi_match": {
            "query": "my first query",
            "fields": [
                "title^10",
                "text^1"
            ]
        }
    }
}