# Own function in search template

**URL:** https://discuss.elastic.co/t/own-function-in-search-template/259126
**Category:** Elasticsearch
**Created:** [December 18, 2020, 4:56pm UTC](https://discuss.elastic.co/t/own-function-in-search-template/259126 "2020-12-18T16:56:58Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![sundarcse1216](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sundarcse1216/32/29349_2.png) [@sundarcse1216](https://discuss.elastic.co/u/sundarcse1216)
#### Post date: [December 18, 2020, 4:56pm UTC](https://discuss.elastic.co/t/own-function-in-search-template/259126/1 "2020-12-18T16:56:59Z")

</div>

I need to write my own function inside the search template like **toJson**

```auto
.............
"functions": [
				{
					"filter": { 
						"terms": { 
							"empId": {{#my_own_function}}PARAM_VALUE{{/my_own_function}} 
						}
					}, 
					"weight": 20
				}
			],
			"score_mode": "multiply"
.........................................

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [January 15, 2021, 4:57pm UTC](https://discuss.elastic.co/t/own-function-in-search-template/259126/2 "2021-01-15T16:57:14Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
