Gauss Function returning 1 for all results


#1

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

  {
    "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. 110.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.


(system) #2