I am new to Elasticsearch queries and I am trying to combine two aggregations into one aggregation field.
Below I have the basic idea I am trying to get to. I realize that statusCategoriesCombo wont work that way, but I think it helps demonstrate what I am after.
I'm not sure what these aggregations would represent. Ordinarily aggregations are used to account for docs that bring certain combinations of things together eg department and product. For that to happen you have to have a doc that has these two fields in order to make a relationship.
If you have 2 different fields in 2 different indices it's hard to guess what logic might associate pairs of these values together?
Right. But no single doc would have a first_specialities value AND a second_specialities value so the intersection of values in these sets is zero - no results.
If these 2 fields existed in a doc, yes, you could use a script to count the number of times values co-occurred.
Because these 2 fields exist in different indices (and therefore different docs) your script would just generate "pairs" that were of the form: first_speciality:foo + second_speciality:null and first_speciality:null + second_speciality:bar
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.