First of all, it seems you need to use "_key" rather than "value" inside "order" stanza.
At least that's what the documentation for terms is saying.
After I replaced "value" with "_key" I was indeed able to reproduce the issue, i.e.: pivot did not sort the terms in descending order whereas _search request with aggregations did.
I'll try to debug the code after the weekend.
Thanks for reporting!
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.