def decay(function, field, options = {})
      field_options = options.extract!(:origin, :scale, :offset, :decay).delete_if { |_, v| v.nil? }
      scoring = options.merge(function => {
        field => field_options
      })
      chain { criteria.update_scores scoring }
    end
def decay(function, field, options = {})
      field_options = options.extract!(:origin, :scale, :offset, :decay).delete_if { |_, v| v.nil? }
      scoring = options.merge(function => {
        field => field_options
      })
      chain { criteria.update_scores scoring }
    end
Add a decay scoring to the search. All scores are
 added to the search request and combinded according to
 `boost_mode` and `score_mode`

 The parameters have default values, but those may not
 be very useful for most applications.

 @example
   UsersIndex.decay(
                :gauss,
                :field,
                origin: '11, 12',
                scale: '2km',
                offset: '5km',
                decay: 0.4,
                filter: { foo: :bar})
       # => {body:
              query: {
                gauss: {
                  query: { ...},
                  functions: [{
                    gauss: {
                      field: {
                        origin: '11, 12',
                        scale: '2km',
                        offset: '5km',
                        decay: 0.4
                      }
                    },
                    filter: { foo: :bar }
                  }]
                } } }