# Default mapping for string - analyzed vs non\_analyzed

**URL:** <https://discuss.elastic.co/t/default-mapping-for-string-analyzed-vs-non-analyzed/20172>\
**Category:** Elasticsearch\
**Created:** [October 10, 2014, 1:47am UTC](https://discuss.elastic.co/t/default-mapping-for-string-analyzed-vs-non-analyzed/20172 "2014-10-10T01:47:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nalzapur](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nalzapur/32/899_2.png) [@nalzapur](https://discuss.elastic.co/u/nalzapur)\
**Post date:** [October 10, 2014, 1:47am UTC](https://discuss.elastic.co/t/default-mapping-for-string-analyzed-vs-non-analyzed/20172/1 "2014-10-10T01:47:19Z")

</div>

hi,

we are using elasticsearch to generate default mapping whenever we index  
the document. we cannot really control the document fields, as we let our  
clients define custom fields and we index them automatically, so we have to  
rely on elasticsearch generating the mapping for us.

one issue i am facing right now is for strings, we allow users to sort. if  
strings are not analyzed, the sort results are not accurate. is there any  
way to configure elasticsearch to generate default mapping of a field with  
both as analyzed, and not\_analyzed. for example, say i index this document

post /myindex/app/1  
{  
"name": "full name"  
}

i would like it generate the mapping as

{  
"app":{  
"properties":{  
"name": {  
"type": "string",  
"fields": {  
"raw": { "type": "string", "index": "not\_analyzed" }  
}  
}  
}  
}  
}

"raw" is something that can configure, so i can use it in my application.

thank you.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/40b5e927-13ab-46dc-9f1d-bd34e71279d3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/40b5e927-13ab-46dc-9f1d-bd34e71279d3%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:57am UTC](https://discuss.elastic.co/t/default-mapping-for-string-analyzed-vs-non-analyzed/20172/2 "2017-07-06T00:57:10Z")

</div>


