# Function\_score, gaussian decay, handling multiple by zero

**URL:** <https://discuss.elastic.co/t/function-score-gaussian-decay-handling-multiple-by-zero/117086>\
**Category:** Elasticsearch\
**Created:** [January 25, 2018, 5:09pm UTC](https://discuss.elastic.co/t/function-score-gaussian-decay-handling-multiple-by-zero/117086 "2018-01-25T17:09:47Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![mayya](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mayya/32/83147_2.png) [@mayya](https://discuss.elastic.co/u/mayya)\
**Post date:** [February 4, 2018, 8:26pm UTC](https://discuss.elastic.co/t/function-score-gaussian-decay-handling-multiple-by-zero/117086/2 "2018-02-04T20:26:40Z")

</div>

`function_score` allows you to combine functions in any arbitrary way. For example, to avoid 0 scores, you can add an arbitrary value `0.001` to your gaussian values by using `weight` of `0.001` and `score_mode` of `sum`:

```
"function_score" : {
		"functions": [
			{
				"gauss": {
					"geo.coordinates": {
						"origin": { "lat": 14.18, "lon": -169.67 },
						"scale": "2km"
					}
				}
			},
			{
				"weight" : 0.001
			}
		],
		"score_mode" : "sum"
	}

```

Will this solve your problem?

---

_[View the full topic](https://discuss.elastic.co/t/function-score-gaussian-decay-handling-multiple-by-zero/117086)._
