Distinct names of all matching attributes

Dear all,

i have a list of search results and want that the user can filter by the attributes where the search term is found.
The list with the search results can be loaded in one elasticsearch request and the list of the containing attributes in another request. That is okay, because in the list with the search results maybe 10 documents are enough and anyways I don't want to process the complete list to find the names of the matching attributes.

For example if I search for "100 GB" it is found in 10,001 of my documents.
And the attributes which contain "100 GB" are ["diskSize", "ramSize", "description"]
So I want to give the User the list

  • Disk Size,
  • RAM Size and
  • Description.

Then he can click on Disk Size and I will search for documents where the Disk Size contains "100 GB".
How do I get this list ["diskSize", "ramSize", "description"] quickly?

The highlighing function of elasticsearch can give me the matching attributes of the first 10,000 documents.. let's say: ["diskSize", "ramSize"]. But only the 10,001st document has an attribute named "description" with the search term "100GB". => Problem!
So I would have to change the parameter "index.max_result_window" (default: 10,000) that the last attribute "description" is found and I would have to process all 10,001 documents to get the names of all matching attributes.. which is pretty slow... And the highlighting function itself gets slow anyway (with "only" 10,000 documents)..
So it seems the highlight function is not a good solution.

So maybe I need something like the aggregate functions?
Any Ideas how to solve it?

And one more thing to think about, if possible: Not all documents have the same structure, so if it's possible I want to search though all attributes not just a few named attributes.

Kind regards
Tobias

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.