I have 2 separate indexes, each containing a different type
I want to get combined records from both.

The problem is that one type has field '**email**', the other has '**work\_email**'. However I want to treat them as the same thing for sorting purposes.
That is why I try to use **index\_name** in one of the types.

Here are mappings:

**Index1:**

```
  "mappings": {
     "people": {
        "properties": {
           "work_email": {
              "type": "string",
              "index_name": "email",
              "fields": {
                 "raw": {
                    "type": "string",
                    "index": "not_analyzed"
                 }
              }
           }
        }
     }
  }

```

**Index2:**

```
  "mappings": {
     "companies": {
        "properties": {
           "email": {
              "type": "string",
              "fields": {
                 "raw": {
                    "type": "string",
                    "index": "not_analyzed"
                 }
              }
           }
        }
     }
  }

```

I expect this to work:

```
GET /index1,index2/people,companies/_search?
{
  "sort": [
    {
      "email.raw": {
        "order": "asc"
      }
    }
  ]
}

```

But, I get an error that there is no such field in the 'people' type.
Am I doing something wrong, or is there a better way to achieve what I need?

Here you can find a recreation script that illustrates the problem: <https://gist.github.com/pmishev/11375297>