I am not sure I understand what you are looking for. Could you provide an example? How do you expect the query to know or determine which facets that are relevant?
Let's say, I have two indices medical data and financial data.
i want to make a generic search without pointing to any index.
first search word: cancer
can I get facets for medical data as it is related to medical data.
second search word: profit
similarly, can i get facets for financial data?
we are trying to develop a web app where multiple sources are indexed. so, just trying understand if this is possible. I have no idea how we can achieve this.
so far, what i have seen is, no matter how many sources are indexed, they all have common facets.
so, do i need to figure out the same ? finding common fields across all sources to make them facets?
To explain what this does it's useful to visualise what the aggregations will tune into. Below is an example of all the departments found for a somewhat fuzzy query (combining phrase, ANDed and ORed terms)
The x-axis is match-quality score and the group of results on the far-right is the top-scoring results matching the full search phrase exactly while the left-side is the many low-quality results that match only one of the search terms. The bars are not to scale (number of matching docs) but are the same size because they show percentages of departments found in that score-band.
Note how the high-scoring matches come from a handful of departments while the low-quality matches come from many departments (not much better than taking a random sample of docs.).
The "sampler" aggregation will help focus analysis on the right hand side of this diagram and the significant_terms aggregation will help identify those departments skewed towards being in the right rather than the left.
Re-reading your question - if the challenge is also not knowing which fields to show as well as which values then using copy_to in the mappings to a common field like "all_facets" could help. You would still use the example aggregation I gave, but on the "all_facets" 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.