# Mappings with and without raw type of "multifield" type is behaving differently

**URL:** <https://discuss.elastic.co/t/mappings-with-and-without-raw-type-of-multifield-type-is-behaving-differently/25287>\
**Category:** Elasticsearch\
**Created:** [July 10, 2015, 6:52am UTC](https://discuss.elastic.co/t/mappings-with-and-without-raw-type-of-multifield-type-is-behaving-differently/25287 "2015-07-10T06:52:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anusha6](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@anusha6](https://discuss.elastic.co/u/anusha6)\
**Post date:** [July 10, 2015, 6:52am UTC](https://discuss.elastic.co/t/mappings-with-and-without-raw-type-of-multifield-type-is-behaving-differently/25287/1 "2015-07-10T06:52:34Z")

</div>

Hi,

I have the following mappings inorder to search and even for sorting that field.

```
           "description": {
              "type": "multi_field",
              "fields": {
                 "raw": {
                    "type": "string",
                    "index": "not_analyzed"
                 },
                 "description":
                 { 
                     "type": "string",
              "analyzer": "analyzer_startswith"

                 },
                 "sort_field":
                 {
                "type": "string",
                "analyzer": "keyword_analyzer"

                 }
              }
           }

```

}

And here are my analyzers:

"analysis": {  
"analyzer": {  
"keyword\_analyzer": {  
"filter": "lowercase",  
"tokenizer": "keyword"  
},  
"analyzer\_startswith": {  
"filter": [  
"lowercase"  
],  
"tokenizer": "whitespace"  
},  
"wordAnalyzer": {  
"type": "custom",  
"filter": [  
"lowercase",  
"asciifolding",  
"nGram\_filter"  
],  
"tokenizer": "whitespace"  
},  
"whitespace\_analyzer": {  
"type": "custom",  
"filter": [  
"lowercase",  
"asciifolding"  
],  
"tokenizer": "whitespace"  
}  
},  
"filter": {  
"nGram\_filter": {  
"max\_gram": "20",  
"min\_gram": "1",  
"type": "nGram",  
"token\_chars": [  
"letter",  
"digit",  
"punctuation",  
"symbol"  
]  
}  
}  
}

These above settings am using...

And here is my query:

GET pdlfull/pdlfull\_type/\_search  
{  
"query": {  
"match\_phrase\_prefix": {  
"description": "a"  
}  
},  
"sort": [  
{  
"description.sort\_field": {  
"order": "asc"  
}  
}  
]  
}

When am using the mappings that I kept above am getting one sort of results.  
When I removed that raw field and executing the query am getting another sort of results.  
May I know what is the reason and which is the best solution

Thanks.

---

<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:02am UTC](https://discuss.elastic.co/t/mappings-with-and-without-raw-type-of-multifield-type-is-behaving-differently/25287/2 "2017-07-06T00:02:23Z")

</div>


