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
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": []
}
]
}
]
},