Setting score_mode for queries; like in query_string-query

In function_score queries it is possible to adjust the behavior via the score_mode (max, sum, multiply etc.) Is a similiar configuration possible for other queries?

Example:

We have a index definition with default-fields like this:

{
  "test_boosting_in_default_field" : {
    "aliases" : { },
    "mappings" : { ..},
     "settings" : {
      "index" : {
        "query" : {
          "default_field" : [
            "ABSTRACT",
            "AUTOR^20",
            "BRANCHE",
            .....

Doing a simple query_string-query we got results, where the _score is calculated from the "max score of" all fields that matches (--> max_score of (ABSTRACT, AUTOR and BRANCHE)..). We don't need the max-score of all searched field; instead we want to multiply scores of all machted fields?

Can this be specified at query-time? Didn't found a configuration for this?

Thanks

anyone?

I might be totally misreading this, but aren't the types of a multi match what you are looking for? Specifically most_fields (which is only adding and not multiplying, but it's at least the right direction) instead of best_fields?

Kind of. I'm searching such types for the Query String Query (not a multi match query).
The String-Query searches per default in the "default_field"s from the index definition (see above). The score of matches in those fields should be calculated as "most_fields".
Is there any configuration option which I missed?

From what I know this isn't possible with the query_string and that's why I used multi_match. Generally query_string offers a lot of options and is a good starting point, but for finer control it might IMO not be the right choice.

Thanks @xeraa for helping out. In our use-case we need the full featured query-syntax from the Query String Query. It's a user specific search that uses those operations. Sure, we can rebuild our own String-Query and map it into a very complex Json structure using mulit_match, bool queries and so on. But that seems to make no sense if we just want to change the behavior of scoring over the different fields....
Is there any plan (ticket) to config scoring-behavior for a string-query?

Wait, actually this should be possible: https://www.elastic.co/guide/en/elasticsearch/reference/6.6/query-dsl-query-string-query.html#_cross_field

I took a look at the relevant changes and it was added in 6.0: https://github.com/elastic/elasticsearch/pull/25646

Great. I missed that it was integrated in 6.0. Thanks a lot!

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