1

I understand how to boost query in elasticsearch depending on absolute value of a variable. For example

{
    "query": {
        "bool": [
            { "match": {"field1": {"query": 10, "boost": 2}} }
        ]
    }
}

What I need to do is to make sure the field1 influences the score but I dont know any absolute value. For example, document will field1 = 20 will get higher score as compared to document with field1 = 10. However, this is different from sort. Because sorting is absolute. I just want this variable to contribute to the overall score but this is not the only field controlling the overall score.

3
  • 2
    Check function_score query Commented Nov 4, 2015 at 11:57
  • Thanks Vineet! From there I found field_value_factor. It seems that might solve my problem Commented Nov 4, 2015 at 12:18
  • with multi_match query you can try different fields with different boost filter Commented Nov 4, 2015 at 12:23

1 Answer 1

1

The best solution here would be function_score query It can be seen as the swiss army knife for customizing scores. You can use field_value_factor function in it to achieve what you are looking for.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.