Choosing the default similarity model
In order to change the similarity model used by default, we need to provide a configuration of a similarity model that will be called by default. For example, if we would like to use our mastering_similarity
name as the default one, we would have to change the preceding configuration to the following one (the whole example is stored in the posts_default_similarity.json
file):
{ "settings" : { "index" : { "similarity" : { "default" : { "type" : "classic", "discount_overlaps" : false } } } }, ... }
Because of the fact that the query norm and coordination factors (which were explained in The changed default text scoring in Lucene section, in Chapter 2, The Improved Query DSL) are used by all similarity models globally and are taken from the default similarity, Elasticsearch allows us to change them when needed. To do this, we need to define...