1

When searching document by title and I using sort by _score, the results are good and document matched with the search keyword.

But my document has the score of its own. and when I using multiple sorts ( qualityScore first and _score of elastics second). the results show qualityScore high first but title matched with search keyword not good.

how can I combine _score more than one condition?

Anyone have an idea please help me. Thank advance.

This is my query

GET member-recipes/_search
{
  "sort": [
    {
      "qualityScore": {
        "order": "desc"
      }
    },
    "_score"
  ],
    "query": {
      "bool": { 
       "must": [
          { "match": {"title": "21-Day-Fix-Instant-Pot-Chicken-Marsala-Stove-top-896247"}}
        ]
      }
    }
}

1 Answer 1

1

You can use function_score search query with qualityScore as field_value_factor (for example with square as modifier)

GET /_search
 {
  "query": {
    "function_score": {
      "field_value_factor": {
        "field": "qualityScore",
        "factor": 1.2,
        "modifier": "sqrt",
        "missing": 1
      },
      "query": {
        "match": {
          "title": "21-Day-Fix-Instant-Pot-Chicken-Marsala-Stove-top-896247"
        }
      }
    }
  }
}
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.