File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -333,6 +333,51 @@ via the REST API, should be written as a string:
333333
334334==================================
335335
336+
337+ [float]
338+ ===== Encoding URLs
339+
340+ The `{{#url}}value{{/url}}` function can be used to encode a string value
341+ in a HTML encoding form as defined in by the http://www.w3.org/TR/html4/[HTML specification].
342+
343+ As an example, it is useful to encode a URL:
344+
345+ [source,js]
346+ ------------------------------------------
347+ GET /_render/template
348+ {
349+ "inline" : {
350+ "query" : {
351+ "term": {
352+ "http_access_log": "{{#url}}{{host}}/{{page}}{{/url}}"
353+ }
354+ }
355+ },
356+ "params": {
357+ "host": "https://www.elastic.co/",
358+ "page": "learn"
359+ }
360+ }
361+ ------------------------------------------
362+ // CONSOLE
363+
364+ The previous query will be rendered as:
365+
366+ [source,js]
367+ ------------------------------------------
368+ {
369+ "template_output" : {
370+ "query" : {
371+ "term" : {
372+ "http_access_log" : "https%3A%2F%2Fwww.elastic.co%2F%2Flearn"
373+ }
374+ }
375+ }
376+ }
377+ ------------------------------------------
378+ // TESTRESPONSE
379+
380+
336381[float]
337382[[pre-registered-templates]]
338383===== Pre-registered template
You can’t perform that action at this time.
0 commit comments