Default mapping for string - analyzed vs non_analyzed


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

"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
To view this discussion on the web visit
For more options, visit