Brian
Brian

Reputation: 14846

ElasticSearch Multi-match and scoring

I'm using the following query on Elastic Search 2.3.3

es_query = {
            "fields": ["title", "content"],
            "query":
            {
            "multi_match" : {
              "query":      "potato tomato",
              "type":       "best_fields",
              "fields":     [ "title_cuis", "content_cuis" ]
            }
          }
        }

I would like the results to be scored so that the first document returned is the one that contains the highest occurrence of the words "tomato" and "potato", but this doesn't seem to happen and I was wondering how I can modify the query to get that without re-indexing.

Upvotes: 0

Views: 2088

Answers (1)

jordivador
jordivador

Reputation: 1096

You're using best_fields, this will use the max score retrieved in matching process from title_cuis or content_cuis, separately.

Take a look to cross-fields

Upvotes: 1

Related Questions