# Doc\_value for numeric field does not match the \_source field value

**URL:** https://discuss.elastic.co/t/doc-value-for-numeric-field-does-not-match-the-source-field-value/218897
**Category:** Elasticsearch
**Created:** [February 12, 2020, 6:07am UTC](https://discuss.elastic.co/t/doc-value-for-numeric-field-does-not-match-the-source-field-value/218897 "2020-02-12T06:07:23Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![kabcampbell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kabcampbell/32/137695_2.png) [@kabcampbell](https://discuss.elastic.co/u/kabcampbell)
#### Post date: [February 12, 2020, 6:07am UTC](https://discuss.elastic.co/t/doc-value-for-numeric-field-does-not-match-the-source-field-value/218897/1 "2020-02-12T06:07:23Z")

</div>

Running Elasticsearch 6.8.0.

I have a field of type `float`. Here is the mapping:

```
"constructionCost" : {
     "type" : "float"
 }

```

It is being populated from a SQL Server `decimal(19,4)` column.

Here is my query:

```
GET projects/_search
{
  "aggs": {
    "cost": {
      "terms": {
        "field": "constructionCost"
      }
    }
  }, 
  "_source": "constructionCost", 
  "query": {
    "term": {
      "elastic_id": {
        "value": "xxxxxx"
      }
    }
  }
}

```

Results:

```
{
  "took" : 24,
  "timed_out" : false,
  "_shards" : {
    "total" : 3,
    "successful" : 3,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : 1,
    "max_score" : 13.269231,
    "hits" : [
      {
        "_index" : "prjs_5_3_1923_0",
        "_type" : "_doc",
        "_id" : "xxxxxxxx",
        "_score" : 13.269231,
        "_routing" : "xxxxxxxx",
        "_source" : {
          "constructionCost" : 582170.29
        }
      }
    ]
  },
  "aggregations" : {
    "cost" : {
      "doc_count_error_upper_bound" : 0,
      "sum_other_doc_count" : 0,
      "buckets" : [
        {
          "key" : 582170.3125,
          "doc_count" : 1
        }
      ]
    }
  }
}

```

Why is the value for constructionCost different? The value in the database matches the value in the \_source field.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [March 11, 2020, 6:07am UTC](https://discuss.elastic.co/t/doc-value-for-numeric-field-does-not-match-the-source-field-value/218897/2 "2020-03-11T06:07:30Z")

</div>

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