diff --git a/docs/reference/search/multi-search.asciidoc b/docs/reference/search/multi-search.asciidoc index d32cd45d87d8f..293fb530cfa11 100644 --- a/docs/reference/search/multi-search.asciidoc +++ b/docs/reference/search/multi-search.asciidoc @@ -80,3 +80,36 @@ This default is based on the number of data nodes and the default search thread === Security See <> + +[float] +[[template-msearch]] +=== Template support + +Much like described in <> for the _search resource, _msearch +also provides support for templates. Submit them like follows: + +[source,js] +----------------------------------------------- +$ cat requests +{"index" : "main"} +{ "inline" : "{ \"query\": { \"match_{{template}}\": {} } }", "params": { "template": "all" } } +{"index" : "main"} +{ "inline" : "{ \"query\": { \"match_{{template}}\": {} } }", "params": { "template": "all" } } + +$ curl -XGET localhost:9200/_msearch/template --data-binary @requests; echo +----------------------------------------------- + +for inline templates. Alternatively for stored templates: + +[source,js] +----------------------------------------------- +$ cat requests +{"index" : "main"} +{ "template": { "id": "template1" },"params": { "q": "foo" } } +{"index" : "main"} +{ "template": { "id": "template2" },"params": { "q": "bar" } } + +$ curl -XGET localhost:9200/_msearch/template --data-binary @requests; echo +---------------------------------------------- + + diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/msearch_template.json b/rest-api-spec/src/main/resources/rest-api-spec/api/msearch_template.json index 39aa53b2572eb..57e0e18966837 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/msearch_template.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/msearch_template.json @@ -1,6 +1,6 @@ { "msearch_template": { - "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html", + "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html", "methods": ["GET", "POST"], "url": { "path": "/_msearch/template",