Multi Match Query with a point field boosting


#1

Hello,
I am trying to do a multi match query with a boost from a field: "point"

My mapping look like that:

PUT Video
{
    "settings" : {
        "number_of_shards" : 8
    },
    "mappings" : {
        "_doc" : {
            "properties" : {
		"id" : { "type" : "long" },
                "name" : { "type" : "text" },
		"original_uploader" : { "type" : "text" },
		"view" : { "type" : "long" },
		"good_point" : { "type" : "long" },
		"bad_point" : { "type" : "long" },
		"category" : { "type" : "text" },
		"theme" : { "type" : "text" }
            }
        }
    }
}

and current query:

POST video/_search
{
  "query": {
    "multi_match": {
      "query": "the query",
      "type": "best_fields",
      "fields": [
        "name",
        "category",
        "theme"
      ],
      "tie_breaker": 0.3,
      "fuzziness": "AUTO"
    }
  }
}

So when I search for a video I would like a query which search in the "name" "Theme" and "category" field but also take the "view" "good_point" "bad_point" as a boost or a malus.
Is there any build-in method in elasticsearch to do that?

Best regards,
Vincent


(Jaspreet Singh) #2

There are a couple of ways of doing what you are trying:

  1. You can leverage combining matches from different fields through boolean like here - https://www.elastic.co/guide/en/elasticsearch/guide/current/multi-query-strings.html
  2. While the above is a more linear variation/boost, if you want something non-linear, consider using decay feature as here - https://www.elastic.co/guide/en/elasticsearch/guide/current/decay-functions.html. It is usually the goto for doing something like boosting content by recency.

(system) #3

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