Assign boost to document at index time

I just read much documents regarding to assign a static boost to a specific document at index time. Some of the docs and function are deprecated. So I am not sure what to use for this particular use case:

I index two simple documents:

Germany and Gerogia in the same index. Germany should have a higher ranking by default because its a country.

Whats the best ways to get this working?

And is this article a good source to get it working?

I'm using version 5.5.0

Thanks in advance

I think your question duplicates the one you opened previously at Pre boost while indexing

Yes. I was not able to delete the previous one. The description of the use case of the post is simpler than in the other question.

Some additional information regarding my researches today.

One option is to use field_value_factor. Which means I create a new field in my document similar to weight to calculate the score by query time. Docs

An additional or other option is the boost on a specific field. In simple words I create another field in my document for example country:boolean and by query time I boost the field country by any value if its true. Docs

What do you think? Is that the right way to go?

I wrote about using function scores over index-time boosts over four years
ago: http://blog.brusic.com/2014/02/document-boosting-in-elasticsearch.html

Since then the function score query has improved, with options such
as field_value_factor. The main takeaway is the same, function scores after
the scoring, to me at least, are more consistent and easier to read.

Thanks Ivan, nice post. Makes some stuff more clear. I will need the stuff for autocomplete functions. If you have any other related documents to share, would be good the have those.

Quite a few things have changed in the past four years since I wrote that
blog post, such as more options in the function score query and field norms
have more precision besides a single byte in Lucene. But ultimately, such
logic does not belong in TD-IDF/BM-25, but outside of it. Besides, with
function scores, you can change the boost level on the fly whenever you
create the query. Waaaaay easier to A/B test different values.

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