# Gauss Function returning 1 for all results

**URL:** <https://discuss.elastic.co/t/gauss-function-returning-1-for-all-results/35101>\
**Category:** Elasticsearch\
**Created:** [November 20, 2015, 12:31am UTC](https://discuss.elastic.co/t/gauss-function-returning-1-for-all-results/35101 "2015-11-20T00:31:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fgv02009](https://avatars.discourse-cdn.com/v4/letter/f/f0a364/32.png) [@fgv02009](https://discuss.elastic.co/u/fgv02009)\
**Post date:** [November 20, 2015, 12:31am UTC](https://discuss.elastic.co/t/gauss-function-returning-1-for-all-results/35101/1 "2015-11-20T00:31:59Z")

</div>

I'm testing out my query and it keeps returning a score of 1 for the gauss part of this request:

```auto
  {
    "query":{
      "function_score":{
        "query":{
          "filtered":{
            "query":{
              "multi_match":{
                "query":"bagel",
                "type":"best_fields",
                "fields":["field1^3","field_2","field_3","field_4"],
                "tie_breaker":0.3,
                "fuzziness":"AUTO"
              }
            },
            "filter":{
              "bool":{
                "must":[{
                  "exists":{
                    "field":"published_at"
                  }
                },{
                  "missing":{
                    "field":"deleted_at"
                  }
                }]
              }
            }
          }
        },
        "functions":[{
          "gauss":{
            "lonlat":{
              "origin":{"lat":42.0,"lon":-87.0},
              "decay":0.7,
              "offset":"1mi",
              "scale":"1mi"
            }
          },
          "boost_factor":10
        }]
      }
    },
    "aggs":{
      "by_chain_id":{
        "terms":{
          "field":"field_5",
          "size":"1000"
        },
        "aggs":{
        "top_business":{
          "top_hits":{
            "size":"1"
          }
        }
      }
    }
  }
}

```

I have two test businesses with the following lonlat `lon: -90.4, lat: 42.0` and `lon: -87.1, lat: 42.0`. Without the gauss function, one is returning a score of .541 and .601, With the gauss function included the scores are 5.41 and 6.01 respectively. Thus, I'm concluding they are both returning a score of 1 from the gauss function. 1_10_.541 = 5.41. I have played with the offset and scale as to make sure that at least the further of the two businesses should have a score \< 1, but I keep getting the same scores. Any ideas as to what could be going on here. Your help is greatly appreciated. Thanks.

---

<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:** [July 5, 2017, 11:37pm UTC](https://discuss.elastic.co/t/gauss-function-returning-1-for-all-results/35101/2 "2017-07-05T23:37:07Z")

</div>


