# Help troubleshoot this template please

**URL:** <https://discuss.elastic.co/t/help-troubleshoot-this-template-please/2329>\
**Category:** Logstash\
**Created:** [June 10, 2015, 2:09pm UTC](https://discuss.elastic.co/t/help-troubleshoot-this-template-please/2329 "2015-06-10T14:09:35Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![abaykal](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@abaykal](https://discuss.elastic.co/u/abaykal)\
**Post date:** [June 10, 2015, 2:09pm UTC](https://discuss.elastic.co/t/help-troubleshoot-this-template-please/2329/1 "2015-06-10T14:09:35Z")

</div>

I am trying to make sure everything is indexed but the username is not analyzed. This is not working. what am i doing wrong?

{  
"template" : "twitter",  
"settings" : {  
"index.refresh\_interval" : "5s"  
},  
"mappings" : {  
"_default_" : {  
"\_all" : {"enabled" : true, "omit\_norms" : true},  
"dynamic\_templates" : [ {  
"message\_field" : {  
"match" : "message",  
"match\_mapping\_type" : "string",  
"mapping" : {  
"type" : "string", "index" : "analyzed", "omit\_norms" : true  
}  
}  
}, {  
"string\_fields" : {  
"match" : "\*",  
"match\_mapping\_type" : "string",  
"mapping" : {  
"type" : "string", "index" : "analyzed", "omit\_norms" : true,  
"fields" : {  
"raw" : {"type": "string", "index" : "not\_analyzed", "ignore\_above" : 256},  
"user.name": {"type": "string", "index" : "not\_analyzed", "ignore\_above" : 256}  
}  
}  
}  
} ],  
"properties" : {  
"@version": { "type": "string", "index": "not\_analyzed" },  
"user.name": { "type": "string", "index": "not\_analyzed" },  
"geoip" : {  
"type" : "object",  
"dynamic": true,  
"properties" : {  
"location" : { "type" : "geo\_point" }  
}  
}  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [June 10, 2015, 3:56pm UTC](https://discuss.elastic.co/t/help-troubleshoot-this-template-please/2329/2 "2015-06-10T15:56:40Z")

</div>

user.name indicates a nested field. Is it a sub-field of object user?

---

<div class="post-metadata">

**Author:** ![abaykal](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@abaykal](https://discuss.elastic.co/u/abaykal)\
**Post date:** [June 10, 2015, 4:30pm UTC](https://discuss.elastic.co/t/help-troubleshoot-this-template-please/2329/3 "2015-06-10T16:30:53Z")

</div>

YEs it is.

---

<div class="post-metadata">

**Author:** ![abaykal](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@abaykal](https://discuss.elastic.co/u/abaykal)\
**Post date:** [June 10, 2015, 4:31pm UTC](https://discuss.elastic.co/t/help-troubleshoot-this-template-please/2329/4 "2015-06-10T16:31:38Z")

</div>

I want to index everything except the user.name subfield which is a string. I am not sure if this would be done in the mapping or properties.

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [June 10, 2015, 4:46pm UTC](https://discuss.elastic.co/t/help-troubleshoot-this-template-please/2329/5 "2015-06-10T16:46:19Z")

</div>

You need to follow the pattern outlined by geoip.location:

```
"geoip" : {
  "type" : "object",
  "dynamic": true,
  "properties" : {
    "location" : { "type" : "geo_point" }
  }
}

```

with _user_, as it is an object:

```
"user" : {
  "type" : "object",
  "dynamic": true,
  "properties" : {
    "name" : { "type": "string", "index": "not_analyzed" }
  }
}

```

You can add whatever other mapping properties once you've defined _user_ as an object. This is roughly what needs to be done.

---

<div class="post-metadata">

**Author:** ![abaykal](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@abaykal](https://discuss.elastic.co/u/abaykal)\
**Post date:** [June 10, 2015, 4:59pm UTC](https://discuss.elastic.co/t/help-troubleshoot-this-template-please/2329/6 "2015-06-10T16:59:17Z")

</div>

This is what I have but it still is analyzing it:  
{  
"template": "twitter",  
"order": 1,  
"settings": {  
"number\_of\_shards": 1  
},  
"mappings": {  
"tweet": {  
"\_all": {  
"enabled": false  
},  
"dynamic\_templates" : [ {  
"message\_field" : {  
"match" : "message",  
"match\_mapping\_type" : "string",  
"mapping" : {  
"type" : "string", "index" : "analyzed", "omit\_norms" : true  
}  
}  
}, {  
"string\_fields" : {  
"match" : "\*",  
"match\_mapping\_type" : "string",  
"mapping" : {  
"type" : "string", "index" : "analyzed", "omit\_norms" : true,  
"fields" : {  
"raw" : {"type": "string", "index" : "not\_analyzed", "ignore\_above" : 256}  
}  
}  
}  
} ],  
"properties": {  
"user" : {  
"type" : "object",  
"dynamic": true,  
"properties" : {  
"name" : { "type": "string", "index": "not\_analyzed" }  
}  
},  
"text": {  
"type": "string"  
},  
"coordinates": {  
"properties": {  
"coordinates": {  
"type": "geo\_point"  
},  
"type": {  
"type": "string"  
}  
}  
}  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [June 10, 2015, 5:13pm UTC](https://discuss.elastic.co/t/help-troubleshoot-this-template-please/2329/7 "2015-06-10T17:13:02Z")

</div>

This mapping template will only be applied to new indices created. Are you running your check against an index which might have the former mapping applied?

---

<div class="post-metadata">

**Author:** ![abaykal](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@abaykal](https://discuss.elastic.co/u/abaykal)\
**Post date:** [June 10, 2015, 5:18pm UTC](https://discuss.elastic.co/t/help-troubleshoot-this-template-please/2329/8 "2015-06-10T17:18:02Z")

</div>

I delete everything and reload again.

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [June 10, 2015, 5:45pm UTC](https://discuss.elastic.co/t/help-troubleshoot-this-template-please/2329/9 "2015-06-10T17:45:35Z")

</div>

You should attach your mapping (not the template) here so we can see what it looks like.

---

<div class="post-metadata">

**Author:** ![abaykal](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@abaykal](https://discuss.elastic.co/u/abaykal)\
**Post date:** [June 10, 2015, 6:00pm UTC](https://discuss.elastic.co/t/help-troubleshoot-this-template-please/2329/10 "2015-06-10T18:00:51Z")

</div>

I thought the template contained the mapping as well -

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [June 10, 2015, 6:31pm UTC](https://discuss.elastic.co/t/help-troubleshoot-this-template-please/2329/11 "2015-06-10T18:31:34Z")

</div>

The template contains the mapping to be applied to new indices. Using the \_mapping API for Elasticsearch allows you to see the mapping currently applied to an entire index, or even just a type within an index. In order to troubleshoot this, we need to know what mapping was actually applied.

---

<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 6, 2017, 5:37am UTC](https://discuss.elastic.co/t/help-troubleshoot-this-template-please/2329/12 "2017-07-06T05:37:49Z")

</div>


