# Apply Boosting Based on a Field Value

**URL:** <https://discuss.elastic.co/t/apply-boosting-based-on-a-field-value/156673>\
**Category:** Elasticsearch\
**Created:** [November 14, 2018, 1:31pm UTC](https://discuss.elastic.co/t/apply-boosting-based-on-a-field-value/156673 "2018-11-14T13:31:30Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![byronvoorbach](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/byronvoorbach/32/8283_2.png) [@byronvoorbach](https://discuss.elastic.co/u/byronvoorbach)\
**Post date:** [November 20, 2018, 10:39am UTC](https://discuss.elastic.co/t/apply-boosting-based-on-a-field-value/156673/21 "2018-11-20T10:39:49Z")

</div>

```
GaussDate(b => b.Field(p => p.Date)
.Origin(DateTime.MaxValue)
.Decay(0.8)
.Scale("1d")
.Filter(f => f.DateRange(dr => dr.GreaterThanOrEquals(DateTime.MaxValue))))

```

This gauss should be applied to all documents where DR is bigger or equals to `DateTime.MaxValue`. Is this even possible?

---

<div class="post-metadata">

**Author:** ![maryam\_abdullah](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@maryam\_abdullah](https://discuss.elastic.co/u/maryam_abdullah)\
**Post date:** [November 20, 2018, 10:43am UTC](https://discuss.elastic.co/t/apply-boosting-based-on-a-field-value/156673/22 "2018-11-20T10:43:13Z")

</div>

It is DateTime.MaxValue, not greater than this value.

---

<div class="post-metadata">

**Author:** ![byronvoorbach](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/byronvoorbach/32/8283_2.png) [@byronvoorbach](https://discuss.elastic.co/u/byronvoorbach)\
**Post date:** [November 20, 2018, 10:45am UTC](https://discuss.elastic.co/t/apply-boosting-based-on-a-field-value/156673/23 "2018-11-20T10:45:25Z")

</div>

So only apply this function on documents where the date (dr) is bigger/equals than December 31, 9999?

---

<div class="post-metadata">

**Author:** ![maryam\_abdullah](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@maryam\_abdullah](https://discuss.elastic.co/u/maryam_abdullah)\
**Post date:** [November 20, 2018, 10:47am UTC](https://discuss.elastic.co/t/apply-boosting-based-on-a-field-value/156673/24 "2018-11-20T10:47:44Z")

</div>

I need it to be applied to documents with date as DateTime.MaxValue. But I don't recall there's an action for matching the exact value, so I used GreaterThanOrEquals.

---

<div class="post-metadata">

**Author:** ![maryam\_abdullah](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@maryam\_abdullah](https://discuss.elastic.co/u/maryam_abdullah)\
**Post date:** [November 21, 2018, 7:43am UTC](https://discuss.elastic.co/t/apply-boosting-based-on-a-field-value/156673/25 "2018-11-21T07:43:42Z")

</div>

I removed the DateTime.MaxValue and set the type property as "pages" and it worked like a charm!

```
  .Functions(fn => fn.FieldValueFactor(fvf => fvf.Field(ff => 
      ff.Importance).Factor(0.00033).Filter(f => !f.Term(t => t.Field(tf => tf.Type).Value("pages"))))
     .FieldValueFactor(fvf => fvf.Field(ff => ff.Importance).Factor(0.009).Filter(f => f.Term(t => t.Field(tf => 
          tf.Type).Value("pages"))))
    .GaussDate(b => b.Field(p => p.Date).Origin(DateMath.Now).Decay(0.5).Scale("140d").Filter(f => 
        f.DateRange(dr => dr.LessThanOrEquals(DateMath.Now))))
 )

```

Thank you so much for everything 😃

---

<div class="post-metadata">

**Author:** ![byronvoorbach](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/byronvoorbach/32/8283_2.png) [@byronvoorbach](https://discuss.elastic.co/u/byronvoorbach)\
**Post date:** [November 21, 2018, 9:36am UTC](https://discuss.elastic.co/t/apply-boosting-based-on-a-field-value/156673/26 "2018-11-21T09:36:30Z")

</div>

Awesome! 😃

Glad that you managed to work it out!

---

<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:** [December 19, 2018, 9:36am UTC](https://discuss.elastic.co/t/apply-boosting-based-on-a-field-value/156673/27 "2018-12-19T09:36:31Z")

</div>

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

[Previous page](https://discuss.elastic.co/t/apply-boosting-based-on-a-field-value/156673.md?page=1)
