# Missing value key in value count aggregation? (ES 1.3.0)

**URL:** <https://discuss.elastic.co/t/missing-value-key-in-value-count-aggregation-es-1-3-0/18919>\
**Category:** Elasticsearch\
**Created:** [July 27, 2014, 3:10pm UTC](https://discuss.elastic.co/t/missing-value-key-in-value-count-aggregation-es-1-3-0/18919 "2014-07-27T15:10:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Valentin\_Pletzer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/valentin_pletzer/32/105548_2.png) [@Valentin\_Pletzer](https://discuss.elastic.co/u/Valentin_Pletzer)\
**Post date:** [July 27, 2014, 3:10pm UTC](https://discuss.elastic.co/t/missing-value-key-in-value-count-aggregation-es-1-3-0/18919/1 "2014-07-27T15:10:05Z")

</div>

Hi,

this looks like an error to me? I tried to order a terms aggregation by the  
value count sub aggregation an Elasticsearch 1.3.0 throws the following  
error: "ReduceSearchPhaseException[Failed to execute phase [query],  
[reduce] ]; nested: ElasticsearchIllegalArgumentException[Invalid order  
path [grades\_count]. Missing value key in [grades\_count] which refers to a  
multi-value metric aggregation]; "

My Aggregation looks like this (this is only a dumbed down version to  
demonstrate the error.)

"aggs": {  
"students": {  
"terms": {  
"field": "name",  
"order": {  
"grades\_count": "desc"  
}  
},  
"aggs": {  
"grades\_count": {  
"value\_count": {  
"field": "grades"  
}  
}  
}  
}  
}

Regards,  
Valentin

--  
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/d4f7ddd2-c959-4b15-91a2-e1e765e38e3a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d4f7ddd2-c959-4b15-91a2-e1e765e38e3a%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![colings86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colings86/32/44960_2.png) [@colings86](https://discuss.elastic.co/u/colings86)\
**Post date:** [July 28, 2014, 7:58am UTC](https://discuss.elastic.co/t/missing-value-key-in-value-count-aggregation-es-1-3-0/18919/2 "2014-07-28T07:58:46Z")

</div>

This does seem to be a bug. I have opened #7050  
[https://github.com/elasticsearch/elasticsearch/issues/7050](https://github.com/elasticsearch/elasticsearch/issues/7050) for this

On Sunday, 27 July 2014 16:10:05 UTC+1, Valentin wrote:

> Hi,
> 
> this looks like an error to me? I tried to order a terms aggregation by  
> the value count sub aggregation an Elasticsearch 1.3.0 throws the following  
> error: "ReduceSearchPhaseException[Failed to execute phase [query],  
> [reduce] ]; nested: ElasticsearchIllegalArgumentException[Invalid order  
> path [grades\_count]. Missing value key in [grades\_count] which refers to a  
> multi-value metric aggregation]; "
> 
> My Aggregation looks like this (this is only a dumbed down version to  
> demonstrate the error.)
> 
> "aggs": {  
> "students": {  
> "terms": {  
> "field": "name",  
> "order": {  
> "grades\_count": "desc"  
> }  
> },  
> "aggs": {  
> "grades\_count": {  
> "value\_count": {  
> "field": "grades"  
> }  
> }  
> }  
> }  
> }
> 
> Regards,  
> Valentin

--  
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/171cc9cf-d61a-4b1d-8f89-356f1ff34651%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/171cc9cf-d61a-4b1d-8f89-356f1ff34651%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:12am UTC](https://discuss.elastic.co/t/missing-value-key-in-value-count-aggregation-es-1-3-0/18919/3 "2017-07-06T01:12:51Z")

</div>


