File tree 1 file changed +45
-0
lines changed
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:
333
333
334
334
==================================
335
335
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
+
336
381
[float]
337
382
[[pre-registered-templates]]
338
383
===== Pre-registered template
You can’t perform that action at this time.
0 commit comments