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

**URL:** <https://discuss.elastic.co/t/change-match-score-mode-from-sum-of-to-max/178949>\
**Category:** Elasticsearch\
**Created:** [April 29, 2019, 1:56pm UTC](https://discuss.elastic.co/t/change-match-score-mode-from-sum-of-to-max/178949 "2019-04-29T13:56:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![grefon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/grefon/32/45747_2.png) [@grefon](https://discuss.elastic.co/u/grefon)\
**Post date:** [April 29, 2019, 1:56pm UTC](https://discuss.elastic.co/t/change-match-score-mode-from-sum-of-to-max/178949/1 "2019-04-29T13:56:58Z")

</div>

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.

 ![Screenshot_4](https://us1.discourse-cdn.com/elastic/original/3X/6/5/65d113280a484faa9af3398ed73343cdb08c4075.png)

**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
> }
> ```

---

<div class="post-metadata">

**Author:** ![grefon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/grefon/32/45747_2.png) [@grefon](https://discuss.elastic.co/u/grefon)\
**Post date:** [May 23, 2019, 4:30pm UTC](https://discuss.elastic.co/t/change-match-score-mode-from-sum-of-to-max/178949/2 "2019-05-23T16:30:36Z")

</div>

Task solved: max\_expansions = 1

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 20, 2019, 4:30pm UTC](https://discuss.elastic.co/t/change-match-score-mode-from-sum-of-to-max/178949/3 "2019-06-20T16:30:42Z")

</div>

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