About elastic full seach text score

We have 4 docs in Elastictsearch index. the docs content as below:

1. { “content”:  "elastic a good engine"}
2.  { “content”:  "elastic a nice password"}
3.  { “content”:  "elastic password is 12344fe"}
4.  { “content”:  "password should be include #2jA"}

then we query by DSL:

{
    "query": {
        "simple_query_string": {
            "fuzzy_max_expansions": 50,
            "fuzzy_prefix_length": 0,
            "fuzzy_transpositions": true,
            "query": "elastic password"
        }
    }
}

Es query resutl:

{
    "took": 1,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 4,
            "relation": "eq"
        },
        "max_score": 0.7309394,
        "hits": [
            {
                "_index": "gatewaylog-test",
                "_id": "7wTrnogBCK1n0bp4ZOiJ",
                "_score": 0.7309394,
                "_source": {
                    "content": "elastic a nice password"
                }
            },
            {
                "_index": "gatewaylog-test",
                "_id": "8ATrnogBCK1n0bp4h-g2",
                "_score": 0.7309394,
                "_source": {
                    "content": "elastic password is 12344fe"
                }
            },
            {
                "_index": "gatewaylog-test",
                "_id": "7gTrnogBCK1n0bp4POhE",
                "_score": 0.3654697,
                "_source": {
                    "content": "elastic a good engine"
                }
            },
            {
                "_index": "gatewaylog-test",
                "_id": "8QTrnogBCK1n0bp4q-iG",
                "_score": 0.33265942,
                "_source": {
                    "content": "password should be include #2jA"
                }
            }
        ]
    }
}

We expected doc { "content": "elastic password is 12344fe"} is the highest score. but ES tell us{ "content": "elastic password is 12344fe"} as same as { “content”: "elastic a nice password"}

So any friend can help us. how do we can get the expected result by query??? thanks .

If you want to make relevant the position of the terms, you can use a Shingle Tokenizer in your analyzer.

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