Browse Source

Add docs to template support for _msearch (#17382)

Add docs to template support for _msearch

Relates to #10885
Relates to #15674

* Reference those docs from the rest api spec for _msearch/template support.
Isabel Drost-Fromm 9 years ago
parent
commit
0e707f241e

+ 33 - 0
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 <<url-access-control>>
+
+[float]
+[[template-msearch]]
+=== Template support
+
+Much like described in <<search-template>> 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
+----------------------------------------------
+
+

+ 1 - 1
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",