A script would work, but if you need to run such queries regularly, the best option would be to have a field that contains both values so that aggregations can leverage ordinals (which are only built per field).
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.