# Problem with getting raw fields

**URL:** https://discuss.elastic.co/t/problem-with-getting-raw-fields/49082
**Category:** Elasticsearch
**Created:** [May 3, 2016, 4:29pm UTC](https://discuss.elastic.co/t/problem-with-getting-raw-fields/49082 "2016-05-03T16:29:59Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mc1392](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@mc1392](https://discuss.elastic.co/u/mc1392)
#### Post date: [May 3, 2016, 4:29pm UTC](https://discuss.elastic.co/t/problem-with-getting-raw-fields/49082/1 "2016-05-03T16:29:59Z")

</div>

If I comment out the index name in my logstash config, I can get my fields as not analyzed.  
If I try to include the index name, my fields are all analyzed.

Why?

Here are my config files.

Logstash:

```
input {
  jdbc {
 xxxxxxxxxxx
}

output{

        elasticsearch {
                #index=>"member_type_history-%{+YYYY.MM.dd}"
                hosts => ["localhost:9200"]
                template => "/home/ubuntu/template/member_type_history_template.json"
                template_name => "ats_member_type_history_template"
                template_overwrite => true
                manage_template => false

        }

#stdout { codec => rubydebug }
}

```

Here is my template:

```
"dynamic_templates": [
{
"ats_member_type_history_template": {
"match_mapping_type": "string",
"match": "*",
"mapping": {
"type": "string",
"fields": {
"raw": {
"type": "string",
"index": "not_analyzed",
"ignore_above": 256
}
}
}
}
}
]
```

---

<div class="post-metadata">

### Author: ![mc1392](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@mc1392](https://discuss.elastic.co/u/mc1392)
#### Post date: [May 3, 2016, 7:41pm UTC](https://discuss.elastic.co/t/problem-with-getting-raw-fields/49082/2 "2016-05-03T19:41:04Z")

</div>

I figured it out.  
I actually DID have to put the template into Elasticsearch first.  
I was trying to reference the JSON template in the logstash config, to no avail.

Here is what works, I put this into sense:

```
PUT /_template/xxx_member_type_history_template
{
  "template": "member_type_history-*",
  "order": 1,
  "mappings": {
    "xxx_member_type_history":{
      "properties": {
        "member type":{
          "type": "string","index": "not_analyzed"
        }
      }
    }
  }
}
```

---

<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:54pm UTC](https://discuss.elastic.co/t/problem-with-getting-raw-fields/49082/3 "2017-07-05T22:54:17Z")

</div>


