title: How to make elasticsearch scoring take field-length into account
body: <p>I created a very simple test index consisting on the following 5 entries:</p>
  
  <pre><code>{    "tags": [        { "topics": "music festival dance techno germany"}    ]}
  {    "tags": [        { "topics": "music festival dance techno"}    ]}
  {    "tags": [        { "topics": "music festival dance"}    ]}
  {    "tags": [        { "topics": "music festival"}    ]}
  {    "tags": [        { "topics": "music"}    ]}
  </code></pre>
  
  <p>Then I performed the following query:</p>
  
  <pre><code>{
    "query": { 
      "bool": { 
        "should": [
          { "match": { "tags.topics": "music festival"}}
        ]
      }
    }
  }
  </code></pre>
  
  <p>Expecting to obtain the following order in the results:</p>
  
  <p>1)  "music festival"</p>
  
  <p>2)  "music festival dance"</p>
  
  <p>3)  "music festival dance techno"</p>
  
  <p>4)  "music festival dance techno germany"</p>
  
  <p>5)  "music"</p>
  
  <p>Accounting for field-length normalization. </p>
  
  <p>However I got the following:</p>
  
  <pre><code>{
      "took": 4,
      "timed_out": false,
      "_shards": {
          "total": 5,
          "successful": 5,
          "skipped": 0,
          "failed": 0
      },
      "hits": {
          "total": 5,
          "max_score": 0.5753642,
          "hits": [
              {
                  "_index": "testindex",
                  "_type": "entry",
                  "_id": "1",
                  "_score": 0.5753642,
                  "_source": {
                      "tags": [
                          {
                              "topics": "music festival dance techno germany"
                          }
                      ]
                  }
              },
              {
                  "_index": "testindex",
                  "_type": "entry",
                  "_id": "3",
                  "_score": 0.5753642,
                  "_source": {
                      "tags": [
                          {
                              "topics": "music festival dance"
                          }
                      ]
                  }
              },
              {
                  "_index": "testindex",
                  "_type": "entry",
                  "_id": "4",
                  "_score": 0.42221835,
                  "_source": {
                      "tags": [
                          {
                              "topics": "music festival"
                          }
                      ]
                  }
              },
              {
                  "_index": "testindex",
                  "_type": "entry",
                  "_id": "2",
                  "_score": 0.32088596,
                  "_source": {
                      "tags": [
                          {
                              "topics": "music festival dance techno"
                          }
                      ]
                  }
              },
              {
                  "_index": "testindex",
                  "_type": "entry",
                  "_id": "5",
                  "_score": 0.2876821,
                  "_source": {
                      "tags": [
                          {
                              "topics": "music"
                          }
                      ]
                  }
              }
          ]
      }
  }
  </code></pre>
  
  <p>Whose order seems absolutely random, except for the lowest score that matched only one word.</p>
  
  <p>What could be causing this and, what could I change (during mapping, indexing or searching), to get the expected order?</p>
  
  <p>Note: The same goes for non-perfect matching queries. Searching "music dance" should still produce the 3 word entry as a first result, so using or boosting term queries seems out of the question.</p>