Sorting by aliased (with index_name) non-analyzed fields


(Plamen Mishev) #1

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
multi_fields.
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/2b68a7af-cc9e-4e79-96f1-40aa9e71fc6c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #2