Sorting by aliased (with index_name) non-analyzed fields

I'm searching in two separate indexes with two separate types at once.

In index1, I have a field 'work_email'.
In index2, I have a field 'email'.

I need to sort all results by email.

For this purpose I looked into using the 'index_name' property of ES, so
the 'work_email' field can be referenced as 'email' too.
On the other hand, in order to get proper the results in the proper order,
I must sort on non-analyzed values, which is why I upgraded my fields to
The problem is that there doesn't seem to be a way to reference the
work_email.raw field as email.raw.

You can see my recreation gist here:

I looked into using 'copy_to' as well, but couldn't figure out a way with
it either.

To sum up: How can I order on non-analyzed field, which is aliased?

Running on:
"version": {
"number": "1.1.1",
"build_hash": "f1585f096d3f3985e73456debdc1a0745f512bbc",
"build_timestamp": "2014-04-16T14:27:12Z",
"build_snapshot": false,
"lucene_version": "4.7"

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