# What doest the weight means in completion suggester?

**URL:** <https://discuss.elastic.co/t/what-doest-the-weight-means-in-completion-suggester/33345>\
**Category:** Elasticsearch\
**Created:** [October 30, 2015, 6:51am UTC](https://discuss.elastic.co/t/what-doest-the-weight-means-in-completion-suggester/33345 "2015-10-30T06:51:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![litaotao](https://avatars.discourse-cdn.com/v4/letter/l/a9a28c/32.png) [@litaotao](https://discuss.elastic.co/u/litaotao)\
**Post date:** [October 30, 2015, 6:51am UTC](https://discuss.elastic.co/t/what-doest-the-weight-means-in-completion-suggester/33345/1 "2015-10-30T06:51:58Z")

</div>

what does the 'weight' means ?  
what if leave out the 'weight' data ?

```
curl -X PUT 'localhost:9200/music/song/1?refresh=true' -d '{
    "name" : "Nevermind",
    "suggest" : {
        "input": ["Nevermind", "Nirvana"],
        "output": "Nirvana - Nevermind",
        "payload" : { "artistId" : 2321 },
        "weight" : 34
    }
}'

```

how does the `score` calculated in the bellow request response ?

```
curl -X POST 'localhost:9200/music/_suggest?pretty' -d '{
    "song-suggest" : {
        "text" : "n",
        "completion" : {
            "field" : "suggest"
        }
    }
}'

{
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "song-suggest" : [ {
    "text" : "n",
    "offset" : 0,
    "length" : 1,
    "options" : [ {
      "text" : "Nirvana - Nevermind",
      "score" : 34.0, "payload" : {"artistId":2321}
    } ]
  } ]
}
```

---

<div class="post-metadata">

**Author:** ![mainec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mainec/32/5557_2.png) [@mainec](https://discuss.elastic.co/u/mainec)\
**Post date:** [October 30, 2015, 7:49am UTC](https://discuss.elastic.co/t/what-doest-the-weight-means-in-completion-suggester/33345/2 "2015-10-30T07:49:33Z")

</div>

> [@litaotao](#):
>
> what does the 'weight' means ?

Weight influences your scoring. For more details see here:

> **[You Complete Me](https://www.elastic.co/blog/you-complete-me)**

and here:

> **[Suggesters | Elasticsearch Guide \[8.11\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html#completion-suggester)**

> [@litaotao](#):
>
> what if leave out the 'weight' data ?

According to [You Complete Me | Elastic Blog](https://www.elastic.co/blog/you-complete-me)

```
Note: If you don't specify a weight then Elasticsearch will use the 
term frequency of the search phrase within its segment, usually 1.
This is pretty much meaningless as far as suggestions go. It is 
better to control order using weight.

```

> [@litaotao](#):
>
> how does the score calculated in the bellow request response ?

According to [You Complete Me | Elastic Blog](https://www.elastic.co/blog/you-complete-me)

```
As you can imagine, the results are now sorted by weight,
which is returned as the score:

```

Hope this helps,  
Isabel

---

<div class="post-metadata">

**Author:** ![litaotao](https://avatars.discourse-cdn.com/v4/letter/l/a9a28c/32.png) [@litaotao](https://discuss.elastic.co/u/litaotao)\
**Post date:** [October 30, 2015, 12:34pm UTC](https://discuss.elastic.co/t/what-doest-the-weight-means-in-completion-suggester/33345/3 "2015-10-30T12:34:37Z")

</div>

@mainec hi, mainec, thanks a lot for the immediately reply, that's very helpful. great thanks again.

---

<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:** [July 5, 2017, 11:41pm UTC](https://discuss.elastic.co/t/what-doest-the-weight-means-in-completion-suggester/33345/4 "2017-07-05T23:41:41Z")

</div>


