# Popularity Boosting with count and date

**URL:** <https://discuss.elastic.co/t/popularity-boosting-with-count-and-date/47101>\
**Category:** Elasticsearch\
**Created:** [April 12, 2016, 10:15am UTC](https://discuss.elastic.co/t/popularity-boosting-with-count-and-date/47101 "2016-04-12T10:15:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![batmaci](https://avatars.discourse-cdn.com/v4/letter/b/f08c70/32.png) [@batmaci](https://discuss.elastic.co/u/batmaci)\
**Post date:** [April 12, 2016, 10:15am UTC](https://discuss.elastic.co/t/popularity-boosting-with-count-and-date/47101/1 "2016-04-12T10:15:16Z")

</div>

I would like to boost my query with order count and publish date for my products but I am not able to understand the concept in order to achieve my goal. here is what I tried based on this [article](https://qbox.io/blog/optimizing-search-results-in-elasticsearch-with-scoring-and-boosting)

I indexed OrderCount as integer and DateCreated as date. But when I try the query below. Something is wrong because value for Date Created is extremely high. This affects the search results and newest products will be returned on top.

```
{
  "explain": true, 
   "size": 5,
   "query": {
      "function_score": {
         "query": {
            "bool": {
               "should": [
                  {
                     "multi_match": {
                        "type": "best_fields",
                        "query": "tn",
                        "fields": [                           
                           "Name^7",
                           "ShortDescription^6"
                        ]
                     }
                  }
               ]
            }
         },
         "functions": [
            {
               "field_value_factor": {
                  "field": "OrderCount",
                  "factor": 0.0001
               }
            },
            {
               "field_value_factor": {
                  "field": "DateCreated" ,   
                    "factor": 0.00001
               }
            }
         ],         
           "boost_mode": "multiply",
            "score_mode" : "multiply"   
      }
   }
}

```

This is how the explanation looks like for datecreated and ordercount. why the value for datecreated is 14310079? how can I use efficiently if I want to have higher ordercount and newer product combination to be on higher ranking?

```
     {
                   "value": 45654876,
                   "description": "min of:",
                   "details": [
                      {
                       "value": 45654876,
                         "description": "function score, score mode [multiply]",
                         "details": [
                            {
                               "value": 3.1904,
                               "description": "function score, product of:",
                               "details": [
                                  {
                                     "value": 1,
                                     "description": "match filter: *:*",
                                     "details": []
                                  },
                                  {
                                     "value": 3.1904,
                                     "description": "field value function: none(doc['OrderCount'].value * factor=1.0E-4)",
                                     "details": []
                                  }
                               ]
                            },
                            {
                               "value": 14310079,
                               "description": "function score, product of:",
                               "details": [
                                  {
                                     "value": 1,
                                     "description": "match filter: *:*",
                                     "details": []
                                  },
                                  {
                                     "value": 14310079,
                                     "description": "field value function: none(doc['DateCreated'].value * factor=1.0E-5)",
                                     "details": []
                                  }
                               ]
                            }
                         ]
                      },
```

---

<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:00pm UTC](https://discuss.elastic.co/t/popularity-boosting-with-count-and-date/47101/2 "2017-07-05T23:00:17Z")

</div>


