According the docs: dis_max without tie_breaker, should return same score, but in practice it doesn't happen

Hi all!

I'm following the Elasticsearch documentation practicing the examples.

I trying to do this: https://www.elastic.co/guide/en/elasticsearch/guide/current/_tuning_best_fields_queries.html

I created two docs in my_index/my_type:

{
          "_id": 1
          "title": "Quick brown rabbits",
          "body": "Brown rabbits are commonly seen."
}

and

{
          "_id": 2
          "title": "Keeping pets healthy",
          "body": "My quick brown fox eats rabbits on a regular basis."
}

So, I performed the query:

{
    "query": {
        "dis_max": {
            "queries": [
                { "match": { "title": "Quick pets" }},
                { "match": { "body":  "Quick pets" }}
            ]
        }
    }
}

What is expected according with above link: obtain the same score in two results.

{
  "hits": [
     {
        "_id": "1",
        "_score": 0.12713557, 
        "_source": {
           "title": "Quick brown rabbits",
           "body": "Brown rabbits are commonly seen."
        }
     },
     {
        "_id": "2",
        "_score": 0.12713557, 
        "_source": {
           "title": "Keeping pets healthy",
           "body": "My quick brown fox eats rabbits on a regular basis."
        }
     }
   ]
}

What I got: Different scores.

"hits": {
    "total": 2,
    "max_score": 0.02250402,
    "hits": [
      {
        "_index": "my_index",
        "_type": "my_type",
        "_id": "2",
        "_score": 0.02250402,
        "_source": {
          "title": "Keeping pets healthy",
          "body": "My quick brown fox eats rabbits on a regular basis."
        }
      },
      {
        "_index": "my_index",
        "_type": "my_type",
        "_id": "1",
        "_score": 0.016645055,
        "_source": {
          "title": "Quick brown rabbits",
          "body": "Brown rabbits are commonly seen."
        }
      }
    ]
  }

Why this occurs? Did I anything wrong? Is it dis_max relevance score broken?

Thank you!

Have a look at the output of the query with ?explain and it should explain it. If I had to guess it is either length norms or different statistics on different shards. If you create the index with a single shard and disable norms on the fields, what does it give then? What does ?explain say then?

It works like a charm.

Thank you for your reply!