Sorting is not giving accurate result

I am trying some simple sort on an ElasticSearch 2.3.1 index.

The index mapping contains an object named "user" which has a few embedded keys.. one of them is also called "user". So I tried to search by "user.user". But the search result is not accurate at all. However sort results based on any key which is not inside an embedded object is fine.

What am I missing ?

Part of index mapping:

"mappings": {
"detail": {
"properties": {
...
. ...
"user": {
"properties": {
"department": {
"type": "string",
"index": "not_analyzed"
},
"location": {
"type": "string",
"index": "not_analyzed"
},
"user": {
"type": "string",
"index": "not_analyzed"
},
}
"

Excerpt from the java code:

    SearchRequestBuilder requestBuilder = client.prepareSearch().setIndices("ua_sensitive").setTypes("detail")
            .setFetchSource(new String[]{"eventUid", "timeOfEventMilli", "user.user"}, null)
           addSort(SortBuilders.fieldSort("user.user").order(SortOrder.ASC));
   SearchResponse response = requestBuilder.execute().actionGet();

Thanks
Abhijit

Just tried to recreate your problem and it looks to be working for me.

Can you post example docs that show the error?

Thanks Mark. I found the reason. In my mapping the field was "not_analyzed", so Elasticsearch was performing case-sensitive sort.
Now I am using a custom analyzer to make the comparison case-insensitive.