Although Elasticsearch offers an efficient scoring algorithm, it may often be inadequate in e-commerce contexts. Most users tend to care only about the topmost number of results. which means that it’s very important to have a flexible scoring mechanism. If you can present the topmost results according to user preference, then your conversion rate is likely to increase significantly.

In this article, we’ll look at the default scoring configuration in Elasticsearch, and we'll also walk through several customizations to the scoring. This knowledge can help you achieve a user-customizable list of results.


For this post, we will be using hosted Elasticsearch on Qbox.io. You can sign up or launch your cluster here, or click "Get Started" in the header navigation. If you need help setting up, refer to "Provisioning a Qbox Elasticsearch Cluster."

By default, Elasticsearch makes use of the Lucene’s practical scoring formula, which represents the relevance score of each document with a positive floating-point number known as the _score. The higher the _score, the higher the relevance of the document. A query clause generates a <strong>_score</strong> for each document, and the calculation for that score depends on the type of query clause.

Query clauses serve different purposes: a fuzzy query might determine the _score by calculating how similar the spelling of the found word is to the original search term; a terms query would incorporate the percentage of terms that were found. However, the more common meaning of relevance is the algorithm that calculates the similarity of the contents of a full-text field in comparison to a full-text query string.

The standard similarity algorithm used in Elasticsearch is known as term frequency/inverse document frequency, or tf/idf, and it takes the following factors into account:

FactorDescription
tfterm frequency
idfinverse document frequency
coordmeasure of matching on multiple terms
lengthnormmeasure of matching on smaller fields
querynormquery normalization factor
boost(index)boost factor at indexing time
boost(query)boost factor at query time

The table above lists the component factors that determine the score of a document in Elasticsearch.

Term Frequency (tf) is a measure of the number of occurrences of a term in a document in context. If the occurrence count is high, the score will be high, and the chances for inclusion of that document as relevant will be high.

Inverse Document Frequency (idf) is a measurement of how frequently the search terms occur across a set of documents. Typically, if the search term commonly occurs across many documents, the score will be low. Frequent occurrence of rare words will typically boost the score value.

Coord is a measurement of matching on multiple search terms, and a higher value of this measurement will increase the overall score. Consider a search for the two terms, "woolen" and "jacket." It doesn’t matter if you issue a term query: this will run internally as a bool query and separate searches will run for each of the terms. A document that has both of these words will get a higher rank than documents containing either of the search terms. If your weight for the query is 2, then a document containing both terms will have a coord factor of 2*2 = 4. However, a document containing only one of these terms will have a coord factor of 2*1 = 2.

lengthnorm measures smaller field matches and gives these more weight. For example, if the search term finds a match in a title field instead of the content field, it may achieve relevance.

Although it is not directly related to document relevance, a querynorm is a measure for comparing queries when you are using a combination of query types.

You can also affect the score with either of the boost factors index time boost and query time boost. Boosting a specific field can cause it to have more significance in the score calculation.

A bit of background: The default Elasticsearch scoring algorithm is a combination of both a Boolean model and Vector Space Model (VSM) Information Retrieval model. All documents that pass the Boolean model then go on to scoring with the Vector Space Model.

This is the scoring formula:

score(q,d) = queryNorm(q) * coord(q,d) * ∑ ( tf(t in d) * idf(t)² * t.getBoost() * norm(t,d)) (t in q)

Of course, we want to see how we can use all of these elements to calculate the score for a document. But first, it’s worth mentioning an important tool for debugging the score for any query in Elasticsearch. If you enable explain in a query, you’ll get a detail listing of the component scores that correspond to each of the factors given above, along with the final score of a document. We do not recommend using it in production, but it can be very helpful as you develop and refine your queries.

The best tool for modifying the _score value of a query is the function_score query.

Elasticsearch actually offers many methods for calculating the score for each match. You can use a custom_score query along with a script to access the value of a particular numeric field. Consider this statement:

"script" : "_score * doc['my_numeric_field'].value"


Here, we are giving weight to the value of my_numeric_field by multiplying it with the default _score. You could also use the custom_filters_score_query, in which you apply filters to restrict the result set and then use a script or a boost to assign a score to any documents that match the filter. Similarly, you could apply the custom_boost_factor to any query to multiply the default score of that query with a boost value. In the 0.19.0 release of Elasticsearch, there is a new query that combines all of these into the function_score query.

The function_score query gives you the ability to define functions to calculate the score. In addition to the built-in functions, you can create more functions with a script. With function_score, you first need to define a query, and optionally apply any filters. Use the filters to restrict the results to only the ones that match your criteria. This reduces the overhead of calculating scores for unwanted matches. If you choose boost mode, you can decide what you want to do with the score that results from any custom function that you create. You can replace the score entirely with the default score, or perhaps multiply the default score with the score that your function calculates.

Elasticsearch also gives you the ability to use multiple functions to calculate a score that combines the results of each function. There are also many ways to use function_score query to account for various factors such as recency, distance from a particular point, and popularity. Let’s go further now and see what options are available for tuning the relevancy of a data set. (The article continues below this information panel.)

The script_score function lets you define a scoring function in a script expression. With the field_value_factor, you can access the value of a particular field so that its value can directly contribute to calculation of the final score. The DECAY_FUNCTION will give you the score in terms of a decaying mode.

Consider an example where you need to find the distance from a geographic point, and you want to give a weighting to points within 5 [km] that is 3 times greater than points that are greater than 5 [km]. Another example: you want to score with respect to the publishing date such that documents with a publish date within the first 15 days should get a score of 7, the documents having a publish date within the next 25 days should get a score of 3, and so on. In these cases you can use DECAY_FUNCTION as well as the weight function and random function. Of course, you can write a custom function in which you apply modifications to any of these functions.

As we noted above, you can use multiple functions to calculate a score, and then use score_mode and boost_mode to combine the output of those functions. The score_mode defines how the scores from your individual functions will combine, and boost_mode defines how you want to apply the value of a specific function result to the default score-either adding to or mulitplying with the cummulative total of all function results. The tables below list the option for boost_mode and score_mode.

Options in boost_mode

Options in score_mode

multiply    multiply the function scores (this is the default)
sum            add the function scores
avg            average the function scores
first        apply the first function score that has a matching filter
min            take the smallest of the function scores
max             take the largest of the function scores

Now let us consider a complete example. Let’s perform a search and, instead of taking the default topmost results, let’s configure our ranking to be one of decreasing popularity. We index the rating in advance, and we assume that a higher item rating corresponds to a higher popularity for a specific item. A simple way to achieve this is to define a function_score query and use the built-in field_value_factor function to access the rating value, as we show below:

POST /ecomercedata/gadgets/_search
{
   "explain": true, 
   "query": {
      "function_score": {
        "query": {
            "match_all": {}
         },
         "functions": [
                        {
               "field_value_factor": {
                  "field": "rating"
               }
            }
         ],
                  "boost_mode": "multiply"
      }
   }
}

Take a moment to review the output below. The factors t.getboost() and boost won’t be visible because they are hidden in the querynorm calculation. It's worth trying adding a boost value to a particular field, and you can see that matches corresponding to it have a higher querynorm value in the explanation.



{{   "took": 22,
   "timed_out": false,
   "_shards": {
      "total": 1,
      "successful": 1,
      "failed": 0
   },
   "hits": {
      "total": 9,
      "max_score": 9,
      "hits": [
         {
            "_shard": 0,
            "_node": "477kWUQVR2eiLpIQEN4vFw",
            "_index": "ecomercedata",
            "_type": "gadgets",
            "_id": "nKk9DfRnTDyUU80cepXRrw",
            "_score": 9,
            "_source": {
               "name": "MacBookPro",
               "category": "Laptop",
               "brand": "Apple",
               "rating": 9,
               "prize": 1299,
               "piecesSold": 9500,
               "dateOfRelease": "2005-02-01"
            },
            "_explanation": {
               "value": 9,
               "description": "function score, product of:",
               "details": [
                  {
                     "value": 1,
                     "description": "ConstantScore(*:*), product of:",
                     "details": [
                        {
                           "value": 1,
                           "description": "boost"
                        },
                        {
                           "value": 1,
                           "description": "queryNorm"
                        }
                     ]
                  },
                  {
                     "value": 9,
                     "description": "Math.min of",
                     "details": [
                        {
                           "value": 9,
                           "description": "function score, score mode [multiply]",
                           "details": [
                              {
                                 "value": 9,
                                 "description": "function score, product of:",
                                 "details": [
                                    {
                                       "value": 1,
                                       "description": "match filter: *:*"
                                    },
                                    {
                                       "value": 9,
                                       "description": "field value function: (doc['rating'].value * factor=1.0)",
                                       "details": [
                                          {
                                             "value": 1,
                                             "description": "ConstantScore(*:*), product of:",
                                             "details": [
                                                {
                                                   "value": 1,
                                                   "description": "boost"
                                                },
                                                {
                                                   "value": 1,
                                                   "description": "queryNorm"
                                                }
                                             ]
                                          }
                                       ]
                                    }
                                 ]
                              }
                           ]
                        },
                        {
                           "value": 3.4028235e+38,
                           "description": "maxBoost"
                        }
                     ]
                  },
                  {
                     "value": 1,
                     "description": "queryBoost"
                  }
               ]
            }
         },
         {
            "_shard": 0,
            "_node": "477kWUQVR2eiLpIQEN4vFw",
            "_index": "ecomercedata",
            "_type": "gadgets",
            "_id": "KNycQwC5TcSmhXPBdKgW3g",
            "_score": 9,
            "_source": {
               "name": "Ipad",
               "category": "Tablet",
               "brand": "Apple",
               "rating": 9,
               "prize": 600,
               "piecesSold": 9500,
               "dateOfRelease": "2005-07-01"
            },
            "_explanation": {
               "value": 9,
               "description": "function score, product of:",
               "details": [
                  {
                     "value": 1,
                     "description": "ConstantScore(*:*), product of:",
                     "details": [
                        {
                           "value": 1,
                           "description": "boost"
                        },
                        {
                           "value": 1,
                           "description": "queryNorm"
                        }
                     ]
                  },
                  {
                     "value": 9,
                     "description": "Math.min of",
                     "details": [
                        {
                           "value": 9,
                           "description": "function score, score mode [multiply]",
                           "details": [
                              {
                                 "value": 9,
                                 "description": "function score, product of:",
                                 "details": [
                                    {
                                       "value": 1,
                                       "description": "match filter: *:*"
                                    },
                                    {
                                       "value": 9,
                                       "description": "field value function: (doc['rating'].value * factor=1.0)",
                                       "details": [
                                          {
                                             "value": 1,
                                             "description": "ConstantScore(*:*), product of:",
                                             "details": [
                                                {
                                                   "value": 1,
                                                   "description": "boost"
                                                },
                                                {
                                                   "value": 1,
                                                   "description": "queryNorm"
                                                }
                                             ]
                                          }
                                       ]
                                    }
                                 ]
                              }
                           ]
                        },
                        {
                           "value": 3.4028235e+38,
                           "description": "maxBoost"
                        }
                     ]
                  },
                  {
                     "value": 1,
                     "description": "queryBoost"
                  }
               ]
            }
         },
         {
            "_shard": 0,
            "_node": "477kWUQVR2eiLpIQEN4vFw",
            "_index": "ecomercedata",
            "_type": "gadgets",
            "_id": "IfTr4n90Tbez-t26Iu6JCg",
            "_score": 8,
            "_source": {
               "name": "MacBookAir",
               "category": "Laptop",
               "brand": "Apple",
               "rating": 8,
               "prize": 1099,
               "piecesSold": 8700,
               "dateOfRelease": "2006-05-01"
            },
            "_explanation": {
               "value": 8,
               "description": "function score, product of:",
               "details": [
                  {
                     "value": 1,
                     "description": "ConstantScore(*:*), product of:",
                     "details": [
                        {
                           "value": 1,
                           "description": "boost"
                        },
                        {
                           "value": 1,
                           "description": "queryNorm"
                        }
                     ]
                  },
                  {
                     "value": 8,
                     "description": "Math.min of",
                     "details": [
                        {
                           "value": 8,
                           "description": "function score, score mode [multiply]",
                           "details": [
                              {
                                 "value": 8,
                                 "description": "function score, product of:",
                                 "details": [
                                    {
                                       "value": 1,
                                       "description": "match filter: *:*"
                                    },
                                    {
                                       "value": 8,
                                       "description": "field value function: (doc['rating'].value * factor=1.0)",
                                       "details": [
                                          {
                                             "value": 1,
                                             "description": "ConstantScore(*:*), product of:",
                                             "details": [
                                                {
                                                   "value": 1,
                                                   "description": "boost"
                                                },
                                                {
                                                   "value": 1,
                                                   "description": "queryNorm"
                                                }
                                             ]
                                          }
                                       ]
                                    }
                                 ]
                              }
                           ]
                        },
                        {
                           "value": 3.4028235e+38,
                           "description": "maxBoost"
                        }
                     ]
                  },
                  {
                     "value": 1,
                     "description": "queryBoost"
                  }
               ]
            }
         },
         {
            "_shard": 0,
            "_node": "477kWUQVR2eiLpIQEN4vFw",
            "_index": "ecomercedata",
            "_type": "gadgets",
            "_id": "90hw7WyKSu2X0YAk3NBTMQ",
            "_score": 8,
            "_source": {
               "name": "ATIVBook",
               "category": "Laptop",
               "brand": "Samsung",
               "rating": 8,
               "prize": 1899,
               "piecesSold": 3500,
               "dateOfRelease": "2014-05-01"
            },
            "_explanation": {
               "value": 8,
               "description": "function score, product of:",
               "details": [
                  {
                     "value": 1,
                     "description": "ConstantScore(*:*), product of:",
                     "details": [
                        {
                           "value": 1,
                           "description": "boost"
                        },
                        {
                           "value": 1,
                           "description": "queryNorm"
                        }
                     ]
                  },
                  {
                     "value": 8,
                     "description": "Math.min of",
                     "details": [
                        {
                           "value": 8,
                           "description": "function score, score mode [multiply]",
                           "details": [
                              {
                                 "value": 8,
                                 "description": "function score, product of:",
                                 "details": [
                                    {
                                       "value": 1,
                                       "description": "match filter: *:*"
                                    },
                                    {
                                       "value": 8,
                                       "description": "field value function: (doc['rating'].value * factor=1.0)",
                                       "details": [
                                          {
                                             "value": 1,
                                             "description": "ConstantScore(*:*), product of:",
                                             "details": [
                                                {
                                                   "value": 1,
                                                   "description": "boost"
                                                },
                                                {
                                                   "value": 1,
                                                   "description": "queryNorm"
                                                }
                                             ]
                                          }
                                       ]
                                    }
                                 ]
                              }
                           ]
                        },
                        {
                           "value": 3.4028235e+38,
                           "description": "maxBoost"
                        }
                     ]
                  },
                  {
                     "value": 1,
                     "description": "queryBoost"
                  }
               ]
            }
         },
         {
            "_shard": 0,
            "_node": "477kWUQVR2eiLpIQEN4vFw",
            "_index": "ecomercedata",
            "_type": "gadgets",
            "_id": "xquXInoJSSOnPwuzrOTO8A",
            "_score": 8,
            "_source": {
               "name": "GalaxyTab",
               "category": "Tablet",
               "brand": "Samsung",
               "rating": 8,
               "prize": 550,
               "piecesSold": 8500,
               "dateOfRelease": "2007-07-01"
            },
            "_explanation": {
               "value": 8,
               "description": "function score, product of:",
               "details": [
                  {
                     "value": 1,
                     "description": "ConstantScore(*:*), product of:",
                     "details": [
                        {
                           "value": 1,
                           "description": "boost"
                        },
                        {
                           "value": 1,
                           "description": "queryNorm"
                        }
                     ]
                  },
                  {
                     "value": 8,
                     "description": "Math.min of",
                     "details": [
                        {
                           "value": 8,
                           "description": "function score, score mode [multiply]",
                          "details": [
                              {
                                 "value": 8,
                                 "description": "function score, product of:",
                                 "details": [
                                    {
                                       "value": 1,
                                       "description": "match filter: *:*"
                                    },
                                    {
                                       "value": 8,
                                       "description": "field value function: (doc['rating'].value * factor=1.0)",
                                       "details": [
                                          {
                                             "value": 1,
                                             "description": "ConstantScore(*:*), product of:",
                                             "details": [
                                                {
                                                   "value": 1,
                                                   "description": "boost"
                                                },
                                                {
                                                   "value": 1,
                                                   "description": "queryNorm"
                                                }
                                             ]
                                          }
                                       ]
                                    }
                                 ]
                              }
                           ]
                        },
                        {
                           "value": 3.4028235e+38,
                           "description": "maxBoost"
                        }
                     ]
                  },
                  {
                     "value": 1,
                     "description": "queryBoost"
                  }
               ]
            }
         },
         {
            "_shard": 0,
            "_node": "477kWUQVR2eiLpIQEN4vFw",
            "_index": "ecomercedata",
            "_type": "gadgets",
            "_id": "qnSLIKIWTsyjRdM0dNcrWg",
            "_score": 8,
            "_source": {
               "name": "Iphone",
               "category": "Mobile",
               "brand": "Apple",
               "rating": 8,
               "prize": 60,
               "piecesSold": 28000,
               "dateOfRelease": "2002-03-01"
            },
            "_explanation": {
               "value": 8,
               "description": "function score, product of:",
               "details": [
                  {
                     "value": 1,
                     "description": "ConstantScore(*:*), product of:",
                     "details": [
                        {
                           "value": 1,
                           "description": "boost"
                        },
                        {
                           "value": 1,
                           "description": "queryNorm"
                        }
                     ]
                  },
                  {
                     "value": 8,
                     "description": "Math.min of",
                     "details": [
                        {
                           "value": 8,
                           "description": "function score, score mode [multiply]",
                           "details": [
                              {
                                 "value": 8,
                                 "description": "function score, product of:",
                                 "details": [
                                    {
                                       "value": 1,
                                       "description": "match filter: *:*"
                                    },
                                    {
                                       "value": 8,
                                       "description": "field value function: (doc['rating'].value * factor=1.0)",
                                       "details": [
                                          {
                                             "value": 1,
                                             "description": "ConstantScore(*:*), product of:",
                                             "details": [
                                                {
                                                   "value": 1,
                                                   "description": "boost"
                                                },
                                                {
                                                   "value": 1,
                                                   "description": "queryNorm"
                                                }
                                             ]
                                          }
                                       ]
                                    }
                                 ]
                              }
                           ]
                        },
                        {
                           "value": 3.4028235e+38,
                           "description": "maxBoost"
                        }
                     ]
                  },
                  {
                     "value": 1,
                     "description": "queryBoost"
                  }
               ]
            }
         },
         {
            "_shard": 0,
            "_node": "477kWUQVR2eiLpIQEN4vFw",
            "_index": "ecomercedata",
            "_type": "gadgets",
            "_id": "uq5kDPYlTQC6mRBJDtS2lQ",
            "_score": 8,
            "_source": {
               "name": "Xperia",
               "category": "Mobile",
               "brand": "Sony",
               "rating": 8,
               "prize": 70,
               "piecesSold": 24000,
               "dateOfRelease": "2004-03-01"
            },
            "_explanation": {
               "value": 8,
               "description": "function score, product of:",
               "details": [
                  {
                     "value": 1,
                     "description": "ConstantScore(*:*), product of:",
                     "details": [
                        {
                           "value": 1,
                           "description": "boost"
                        },
                        {
                           "value": 1,
                           "description": "queryNorm"
                        }
                     ]
                  },
                  {
                     "value": 8,
                     "description": "Math.min of",
                     "details": [
                        {
                          "value": 8,
                           "description": "function score, score mode [multiply]",
                           "details": [
                              {
                                 "value": 8,
                                 "description": "function score, product of:",
                                 "details": [
                                    {
                                       "value": 1,
                                       "description": "match filter: *:*"
                                    },
                                    {
                                       "value": 8,
                                       "description": "field value function: (doc['rating'].value * factor=1.0)",
                                       "details": [
                                          {
                                             "value": 1,
                                             "description": "ConstantScore(*:*), product of:",
                                             "details": [
                                                {
                                                   "value": 1,
                                                   "description": "boost"
                                                },
                                                {
                                                   "value": 1,
                                                   "description": "queryNorm"
                                                }
                                             ]
                                          }
                                       ]
                                    }
                                 ]
                              }
                           ]
                        },
                        {
                           "value": 3.4028235e+38,
                           "description": "maxBoost"
                        }
                     ]
                  },
                  {
                     "value": 1,
                     "description": "queryBoost"
                  }
               ]
            }
         },
         {
            "_shard": 0,
            "_node": "477kWUQVR2eiLpIQEN4vFw",
            "_index": "ecomercedata",
            "_type": "gadgets",
            "_id": "YdtFFxICR-6nMxNcQmWoaQ",
            "_score": 6,
            "_source": {
               "name": "Inspiron",
               "category": "Laptop",
               "brand": "Dell",
               "rating": 6,
               "prize": 700,
               "piecesSold": 4600,
               "dateOfRelease": "2008-03-01"
            },
            "_explanation": {
               "value": 6,
               "description": "function score, product of:",
               "details": [
                  {
                     "value": 1,
                     "description": "ConstantScore(*:*), product of:",
                     "details": [
                        {
                           "value": 1,
                           "description": "boost"
                        },
                        {
                           "value": 1,
                           "description": "queryNorm"
                        }
                     ]
                  },
                  {
                     "value": 6,
                     "description": "Math.min of",
                     "details": [
                       {
                           "value": 6,
                           "description": "function score, score mode [multiply]",
                           "details": [
                              {
                                 "value": 6,
                                 "description": "function score, product of:",
                                 "details": [
                                    {
                                       "value": 1,
                                       "description": "match filter: *:*"
                                    },
                                    {
                                       "value": 6,
                                       "description": "field value function: (doc['rating'].value * factor=1.0)",
                                       "details": [
                                          {
                                             "value": 1,
                                             "description": "ConstantScore(*:*), product of:",
                                             "details": [
                                                {
                                                   "value": 1,
                                                   "description": "boost"
                                                },
                                                {
                                                   "value": 1,
                                                   "description": "queryNorm"
                                                }
                                             ]
                                          }
                                       ]
                                    }
                                 ]
                              }
                           ]
                        },
                        {
                           "value": 3.4028235e+38,
                           "description": "maxBoost"
                        }
                     ]
                  },
                  {
                     "value": 1,
                     "description": "queryBoost"
                  }
               ]
            }
         },
         {
            "_shard": 0,
            "_node": "477kWUQVR2eiLpIQEN4vFw",
            "_index": "ecomercedata",
            "_type": "gadgets",
            "_id": "MjSPJ9hqTbu8U6PfyMrl4A",
            "_score": 6,
            "_source": {
               "name": "Lumia",
               "category": "Mobile",
               "brand": "Nokia",
               "rating": 6,
               "prize": 50,
               "piecesSold": 12000,
               "dateOfRelease": "2009-03-01"
            },
            "_explanation": {
               "value": 6,
               "description": "function score, product of:",
               "details": [
                  {
                     "value": 1,
                     "description": "ConstantScore(*:*), product of:",
                     "details": [
                        {
                           "value": 1,
                           "description": "boost"
                        },
                        {
                           "value": 1,
                           "description": "queryNorm"
                        }
                     ]
                  },
                  {
                     "value": 6,
                     "description": "Math.min of",
                     "details": [
                        {
                           "value": 6,
                           "description": "function score, score mode [multiply]",
                           "details": [
                              {
                                 "value": 6,
                                 "description": "function score, product of:",
                                 "details": [
                                    {
                                       "value": 1,
                                       "description": "match filter: *:*"
                                    },
                                    {
                                       "value": 6,
                                       "description": "field value function: (doc['rating'].value * factor=1.0)",
                                       "details": [
                                          {
                                             "value": 1,
                                             "description": "ConstantScore(*:*), product of:",
                                             "details": [
                                                {
                                                   "value": 1,
                                                   "description": "boost"
                                                },
                                                {
                                                   "value": 1,
                                                   "description": "queryNorm"
                                                }
                                             ]
                                          }
                                       ]
                                    }`
                                 ]
                              }
                           ]
                        },
                        {
                           "value": 3.4028235e+38,
                           "description": "maxBoost"
                        }
                     ]
                  },
                  {
                     "value": 1,
                     "description": "queryBoost"
                  }
               ]
            }
         }
      ]
   }
}

You may be thinking that we should consider the recency of the product in the score calculation. Perhaps the newer products should be given a heavier weighting than the old ones and then combine this weighting with popularity factor shown above. We would then modify our example in this way:

POST /ecomercedata/gadgets/_search
{ 
   "query": {
      "function_score": {
         "query": {
            "match_all": {}
         },
         "functions": [
                        {
               "field_value_factor": {
                  "field": "rating"
               }
            },
            {
               "field_value_factor": {
                  "field": "dateOfRelease",
                  
               }
            }
         ],
                  "boost_mode": "replace",
                  "score_mode" : "multiply"      
      }
}

With these modifications, the results will show that the score value rises to a very large number. There are ways to avoid this, and there are ways to have more control over the weightage that assign to a function. There are also other options for calculating the score with custom scripts. We’ll consider these and other options in my next blog article.


Questions? Just drop us a note, and we'll get you a prompt response.

Not yet enjoying the benefits of a hosted ELK-stack enterprise search on Qbox? We invite you to create a free account today and discover how easy it is to manage and scale your Elasticsearch environment in our cloud hosting service.


comments powered by Disqus