Question for completion suggester score

I am trying to understand how the score works for completion suggester. When I tested with the prefix search, the score always returns 1.0.

Below is my testing:
1): Create one index with suggest field:

PUT testidx
{
    "mappings": {
        "word" : {
            "properties" : {
                "suggest" : {
                    "type" : "completion"
                }
            }
        }
    }
}

2): Index three documents:

PUT testidx/word/1?refresh
{
    "suggest" : {
        "input": [ "complementary", "come" ]
    }
}

PUT testidx/word/2?refresh
{
    "suggest" : {
        "input": [ "complementary"]
    }
}

PUT testidx/word/3?refresh
{
    "suggest" : {
        "input": [ "complementary", "compile"]
    }
}

3): Execute the suggest search:

POST testidx/_search
{
    "suggest": {
        "word-suggest" : {
            "prefix" : "com",
            "completion" : {
                "field" : "suggest"
            }
        }
    }
}

And below is the result:

{
    "took": 58,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "failed": 0
    },
    "hits": {
        "total": 0,
        "max_score": 0,
        "hits": []
    },
    "suggest": {
        "word-suggest": [
            {
                "text": "com",
                "offset": 0,
                "length": 3,
                "options": [
                    {
                        "text": "come",
                        "_index": "testidx",
                        "_type": "word",
                        "_id": "1",
                        "_score": 1,
                        "_source": {
                            "suggest": {
                                "input": [
                                    "complementary",
                                    "come"
                                ]
                            }
                        }
                    },
                    {
                        "text": "compile",
                        "_index": "testidx",
                        "_type": "word",
                        "_id": "3",
                        "_score": 1,
                        "_source": {
                            "suggest": {
                                "input": [
                                    "complementary",
                                    "compile"
                                ]
                            }
                        }
                    },
                    {
                        "text": "complementary",
                        "_index": "testidx",
                        "_type": "word",
                        "_id": "2",
                        "_score": 1,
                        "_source": {
                            "suggest": {
                                "input": [
                                    "complementary"
                                ]
                            }
                        }
                    }
                ]
            }
        ]
    }
}

I supposed the word "complementary" has higher score because it is appeared in all three documents. But it comes the same score with the "come" or "compile" word. Could you please explain it? Thanks!

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