# Sorting by a nested multi-field only works for one of the fields

**URL:** <https://discuss.elastic.co/t/sorting-by-a-nested-multi-field-only-works-for-one-of-the-fields/17173>\
**Category:** Elasticsearch\
**Created:** [April 24, 2014, 12:12pm UTC](https://discuss.elastic.co/t/sorting-by-a-nested-multi-field-only-works-for-one-of-the-fields/17173 "2014-04-24T12:12:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonathan\_Foy](https://avatars.discourse-cdn.com/v4/letter/j/8edcca/32.png) [@Jonathan\_Foy](https://discuss.elastic.co/u/Jonathan_Foy)\
**Post date:** [April 24, 2014, 12:12pm UTC](https://discuss.elastic.co/t/sorting-by-a-nested-multi-field-only-works-for-one-of-the-fields/17173/1 "2014-04-24T12:12:26Z")

</div>

Hello

In my mapping I have some String values that I need to use for text  
matching as well as for sorting. To support this, I use a multi-field with  
two different versions of the field using two different analyzers. To  
sort, I have a keyword-lowercasing analyzer. For the text search I'm using  
the included snowball analyzer.

This works fine for a normal, top-level field. However, for my nested  
fields using this pattern, only the first/primary field type will allow  
searching. The output from tests using the other always returns a null  
value.

I'm assuming it's somehow related to the pathing (mixing nested pathing  
notation with multi-field notation), but I'm not sure. Does anyone have  
any insight? I have a full working example here[http://sense.qbox.io/gist/92524e522f5096f98c59cc6f2da7ffa213433536](http://sense.qbox.io/gist/92524e522f5096f98c59cc6f2da7ffa213433536)  
.

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/cd3d5501-a34a-4a83-88b6-d5165cec77f9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/cd3d5501-a34a-4a83-88b6-d5165cec77f9%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Jonathan\_Foy](https://avatars.discourse-cdn.com/v4/letter/j/8edcca/32.png) [@Jonathan\_Foy](https://discuss.elastic.co/u/Jonathan_Foy)\
**Post date:** [April 24, 2014, 5:50pm UTC](https://discuss.elastic.co/t/sorting-by-a-nested-multi-field-only-works-for-one-of-the-fields/17173/2 "2014-04-24T17:50:20Z")

</div>

On Thursday, April 24, 2014 8:12:26 AM UTC-4, Jonathan Foy wrote:

> Hello
> 
> In my mapping I have some String values that I need to use for text  
> matching as well as for sorting. To support this, I use a multi-field with  
> two different versions of the field using two different analyzers. To  
> sort, I have a keyword-lowercasing analyzer. For the text search I'm using  
> the included snowball analyzer.
> 
> This works fine for a normal, top-level field. However, for my nested  
> fields using this pattern, only the first/primary field type will allow  
> searching. The output from tests using the other always returns a null  
> value.
> 
> I'm assuming it's somehow related to the pathing (mixing nested pathing  
> notation with multi-field notation), but I'm not sure. Does anyone have  
> any insight? I have a full working example here[http://sense.qbox.io/gist/92524e522f5096f98c59cc6f2da7ffa213433536](http://sense.qbox.io/gist/92524e522f5096f98c59cc6f2da7ffa213433536)  
> .

Received help on SO[http://stackoverflow.com/questions/23255991/elasticsearch-sorting-by-a-nested-multi-field#23275061](http://stackoverflow.com/questions/23255991/elasticsearch-sorting-by-a-nested-multi-field#23275061),  
I was missing the "nested\_path" parameter in the sort definition.

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/284b0c4a-d570-4e07-9201-c30a38f4e63d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/284b0c4a-d570-4e07-9201-c30a38f4e63d%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:33am UTC](https://discuss.elastic.co/t/sorting-by-a-nested-multi-field-only-works-for-one-of-the-fields/17173/3 "2017-07-06T01:33:41Z")

</div>


