您快到了,只需要在到达数组的最后一个元素时让小胡子知道即可。因此,您的模板应如下所示(即,我们在每个元素之后添加逗号(最后一个元素除外)):
... "should":[ {{#since}} { "range": { "{{since}}": { {{#from}}"from": "{{from}}"{{#to}},{{/to}}{{/from}} {{#to}}"to":"{{to}}"{{/to}} } } }{{^last}},{{/last}} <-- modify this line {{/since}} ] ...
然后只需修改您的调用以将
last标志包含到
since数组的最后一个元素即可:
POST _search/template{ "id": "dateTemplate", "params": { "searchkeyword": "*", "since":[ { "since":"@timestamp", "from": "2018-06-01" }, { "since":"@timestamp", "from": "2018-06-08", "last": true <-- add this line } ] }}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)