如何在多搜索(_msearch)API中使用Elasticsearch搜索模板?

时间:2015-01-21 15:08:47

标签: templates search elasticsearch

是否可以在多搜索api(_msearch)请求中使用已注册的搜索模板? 如果是这样,怎么样?

我尝试在一个正文中提供以下查询。

POST /_msearch
{"index":"index1","type":"type1"}
{"template":{"id":"template_1"},"params":{"a":1, "b":2}}

但这会导致错误:

Parse Failure [No parser for element [template]]

我尝试在查询中包装所有内容:

POST /_msearch
{"index":"index1","type":"type1"}
{"query":{"template":{"id":"template_1"},"params":{"a":1, "b":2}}}

并发布到_msearch / template,但这些都没有。

提前致谢

1 个答案:

答案 0 :(得分:1)

目前不支持,但他们有一个开放的增强请求。 Add template support to _msearch #10885