title: Defining a document boost field
body: <p>I'm using ES v0.90.1.
  I want to be able to boost a document of a specific type of my index using one of it's fields.
  As described in <a href="http://www.elasticsearch.org/guide/reference/mapping/boost-field/" rel="nofollow">the official documentation</a> I defined my mapping like that :</p>
  
  <pre><code>{
      "mappings": {
          "mytesttype": {
              "_boost": {
                  "name": "doc_boost",
                  "null_value": 1.0
              },
              "properties": {
                  "date_start": {
                      "type": "date",
                      "format": "date_time"
                  },
                  "date_end": {
                      "type": "date",
                      "format": "date_time"
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>So, in my opinion, i'm saying that my index will have a type <code>mytesttype</code> that has a document boost field named <code>doc_boost</code> with a default value of <code>1</code>.</p>
  
  <p>Here's the index's meta after creation:</p>
  
  <pre><code>{
  
      state: open
      settings: {
          index.number_of_shards: 1
          index.number_of_replicas: 0
          index.version.created: 900199
      }
      mappings: {
          mytesttype: {
              _boost: {
                  null_value: 1
                  name: doc_boost
              }
              properties: {
                  date_end: {
                      format: date_time
                      type: date
                  }
                  date_start: {
                      format: date_time
                      type: date
                  }
                  y: {
                      type: long
                  }
                  x: {
                      type: long
                  }
              }
          }
      }
      aliases: [ ]
  
  }
  </code></pre>
  
  <p>I then tried indexing two documents :</p>
  
  <pre><code>{
      "ref": "ref-1",
      "date_start": "2013-07-01T00:00:00.000+0000",
      "date_end": "2016-07-01T00:00:00.000+0000",
      "y": 100,
      "x": 100,
      "doc_boost": 1.0
  }
  
  {
      "ref": "ref-2",
      "date_start": "2013-07-01T00:00:00.000+0000",
      "date_end": "2016-07-01T00:00:00.000+0000",
      "y": 100,
      "x": 100,
      "doc_boost": 2.0
  }
  </code></pre>
  
  <p>Those two documents are the same except for the <code>doc_boost</code> field and a <code>ref</code> value.</p>
  
  <p>Now my goal is to do a simple request that would get both documents but having as high scored result the one with <code>doc_boost = 2</code>. So here's my request:</p>
  
  <pre><code>{
    "query": {
      "bool": {
        "must": [
          {
            "match": {
              "x": {
                "query": 100,
                "type": "boolean"
              }
            }
          },
          {
            "match": {
              "y": {
                "query": 100,
                "type": "boolean"
              }
            }
          },
          {
            "range": {
              "date_start": {
                "from": null,
                "to": "now",
                "include_lower": true,
                "include_upper": true
              }
            }
          },
          {
            "range": {
              "date_end": {
                "from": "now",
                "to": null,
                "include_lower": true,
                "include_upper": true
              }
            }
          }
        ]
      }
    }
  }
  </code></pre>
  
  <p>I would expect to have a higher score on the <code>ref-2</code> document but here's the response i'm getting, together with the explain output:</p>
  
  <pre><code>{
  
      took: 3
      timed_out: false
      _shards: {
          total: 1
          successful: 1
          failed: 0
      }
      hits: {
          total: 2
          max_score: 2
          hits: [
              {
                  _shard: 0
                  _node: 99cl3dO9TFecp3fDiR3e6A
                  _index: test_elasticsearchtest
                  _type: mytesttype
                  _id: mkwrfEswSj-T5x0c5AObuw
                  _score: 2
                  _source: {
                      ref: ref-1
                      date_start: 2013-07-01T00:00:00.000+0000
                      date_end: 2016-07-01T00:00:00.000+0000
                      y: 100
                      x: 100
                      doc_boost: 1
                  }
                  _explanation: {
                      value: 2
                      description: sum of:
                      details: [
                          {
                              value: 0.5
                              description: ConstantScore(x:[100 TO 100]), product of:
                              details: [
                                  {
                                      value: 1
                                      description: boost
                                  }
                                  {
                                      value: 0.5
                                      description: queryNorm
                                  }
                              ]
                          }
                          {
                              value: 0.5
                              description: ConstantScore(y:[100 TO 100]), product of:
                              details: [
                                  {
                                      value: 1
                                      description: boost
                                  }
                                  {
                                      value: 0.5
                                      description: queryNorm
                                  }
                              ]
                          }
                          {
                              value: 0.5
                              description: ConstantScore(date_start:[* TO 1374063073249]), product of:
                              details: [
                                  {
                                      value: 1
                                      description: boost
                                  }
                                  {
                                      value: 0.5
                                      description: queryNorm
                                  }
                              ]
                          }
                          {
                              value: 0.5
                              description: ConstantScore(date_end:[1374063073249 TO *]), product of:
                              details: [
                                  {
                                      value: 1
                                      description: boost
                                  }
                                  {
                                      value: 0.5
                                      description: queryNorm
                                  }
                              ]
                          }
                      ]
                  }
              }
              {
                  _shard: 0
                  _node: 99cl3dO9TFecp3fDiR3e6A
                  _index: test_elasticsearchtest
                  _type: mytesttype
                  _id: uvtIJ3n2RTad6CHnzENHgA
                  _score: 2
                  _source: {
                      ref: ref-2
                      date_start: 2013-07-01T00:00:00.000+0000
                      date_end: 2016-07-01T00:00:00.000+0000
                      y: 100
                      x: 100
                      doc_boost: 2
                  }
                  _explanation: {
                      value: 2
                      description: sum of:
                      details: [
                          {
                              value: 0.5
                              description: ConstantScore(x:[100 TO 100]), product of:
                              details: [
                                  {
                                      value: 1
                                      description: boost
                                  }
                                  {
                                      value: 0.5
                                      description: queryNorm
                                  }
                              ]
                          }
                          {
                              value: 0.5
                              description: ConstantScore(y:[100 TO 100]), product of:
                              details: [
                                  {
                                      value: 1
                                      description: boost
                                  }
                                  {
                                      value: 0.5
                                      description: queryNorm
                                  }
                              ]
                          }
                          {
                              value: 0.5
                              description: ConstantScore(date_start:[* TO 1374063073249]), product of:
                              details: [
                                  {
                                      value: 1
                                      description: boost
                                  }
                                  {
                                      value: 0.5
                                      description: queryNorm
                                  }
                              ]
                          }
                          {
                              value: 0.5
                              description: ConstantScore(date_end:[1374063073249 TO *]), product of:
                              details: [
                                  {
                                      value: 1
                                      description: boost
                                  }
                                  {
                                      value: 0.5
                                      description: queryNorm
                                  }
                              ]
                          }
                      ]
                  }
              }
          ]
      }
  
  }
  </code></pre>
  
  <p>Both documents have the same score. Could someone explain to me what i did wrong ?</p>