Change match score mode from "sum of" to "max"

Hello!
Sorry for my English ))
Tell me how I can change score mode from "sum of" to "max" on nGram field??
Due to the summation, the elasticsearch gives results that do not suit me. I need to get the maximum value, not the amount.

Index:

{
  "mappings": {
    "addresses": {
      "properties": {
        ...........................
        "tokensName": {
          "type": "text",
          "analyzer": "tokens",
          "similarity": "scripted_tfidf"
        }
        ...........................
      }
    }
  },
  "settings": {
    "similarity": {
      "scripted_tfidf": {
        "type": "scripted",
        "script": {
          "source": "double tf = 1.0; double idf = 1.0; double norm = 1.0; return query.boost * tf * idf * norm * weight;"
        }
      }
    },
    "analysis": {
      "filter": {
        "shingle": {
          "type": "edge_ngram",
          "min_gram": 1,
          "max_gram": 20
        }
      },
      "analyzer": {
        "tokens": {
          "type": "custom",
          "tokenizer": "whitespace",
          "filter": [
            "lowercase",
            "shingle"
          ]
        }
      }
    }
  }
}

Doc:

{
  ...........................
  "tokensName": "ирпень точный университет"
  ...........................
}

Search query:

{
  "size": 5,
  "query": {
    "match": {
      "tokensName": {
        "query": "ирпень фаворит ун точно",
        "analyzer": "standard",
        "fuzziness": "AUTO"
      }
    }
  },
  "explain": true
}

Task solved: max_expansions = 1

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