1

I have a field say "testField", where in there can be numerous string values like. I need to boost the score whenever the value in the field is a particular string,say for example "testValue". How can I do this in elasticsearch?

1 Answer 1

2

You can try using function_score:

{
  "query": {
    "function_score": {
      "query": {
        "match_all": {}
      },
      "functions": [
        {
          "filter": {
            "term": {
              "testField": "testValue"
            }
          },
          "boost_factor": 15
        }
      ]
    }
  }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.