I need to return the most popular items if none are hit with the should clause but would still like the must to apply so popular items obey the category filter in the example.
Most examples I've seen boost the item's score by popularity and that's not at all what I want, popularity is for backfill only.
On stackoverflow @keety suggested the following, which uses the populatiry as a secondary sort on all items. This seems to do what I need except the constant score/matchall needs to be subject to the must clause. I'm just learning the ES JSON API so examples really help.
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.