# Boolean field saving as string

**URL:** <https://discuss.elastic.co/t/boolean-field-saving-as-string/59074>\
**Category:** Elasticsearch\
**Created:** [August 26, 2016, 8:24pm UTC](https://discuss.elastic.co/t/boolean-field-saving-as-string/59074 "2016-08-26T20:24:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lask001](https://avatars.discourse-cdn.com/v4/letter/l/4da419/32.png) [@lask001](https://discuss.elastic.co/u/lask001)\
**Post date:** [August 26, 2016, 8:24pm UTC](https://discuss.elastic.co/t/boolean-field-saving-as-string/59074/1 "2016-08-26T20:24:04Z")

</div>

Hi, hoping someone could take a look at this and tell me what I'm doing wrong....

This is my template:

```
curl -XPUT "http://localhost:9200/_template/test" -d'
{
  "mappings": {
     "_default_": {
        "properties": {
           "site": {
              "index": "not_analyzed",
              "type": "string"
           },
           "@timestamp": {
              "format": "strict_date_time",
              "type": "date"
           },
           "status_code": {
              "type": "integer"
           },
           "problem": {
              "index": "not_analyzed",
              "type": "boolean"
           },
           "response_time": {
              "type": "float"
           }
        }
     }
  }

```

}  
}

When I do a post:

```
curl -XPOST "http://localhost:9200/test-2016.08.26/sitestatus/" -d'
{
    "site" : "www.localhost.com",
    "status_code" : 200,
    "response_time" : .20,
    "@timestamp": "2016-08-26T17:01:00.000Z",
    "problem": "no"
}'

```

No matter what value I save in problem all I get back is that string:

```
   "hits": {
      "total": 2,
      "max_score": 1,
      "hits": [
         {
            "_index": "test-2016.08.26",
            "_type": "sitestatus",
            "_id": "AVbIgKpL2pjTUyDqCfck",
            "_score": 1,
            "_source": {
               "site": "www.localhost.com",
               "status_code": 200,
               "response_time": 0.12,
               "@timestamp": "2016-08-26T17:01:00.000Z",
               "problem": "no"
            }
         }

```

What am I doing wrong? I'm running 2.3.1. Thanks!

---

<div class="post-metadata">

**Author:** ![lask001](https://avatars.discourse-cdn.com/v4/letter/l/4da419/32.png) [@lask001](https://discuss.elastic.co/u/lask001)\
**Post date:** [August 26, 2016, 8:56pm UTC](https://discuss.elastic.co/t/boolean-field-saving-as-string/59074/2 "2016-08-26T20:56:18Z")

</div>

I figured it out. It saves the values, but they still evaluate correctly with a search.

---

<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:** [July 5, 2017, 10:24pm UTC](https://discuss.elastic.co/t/boolean-field-saving-as-string/59074/3 "2017-07-05T22:24:44Z")

</div>

Closed on July 5, 2017, 10:24pm UTC


