I'm trying to do a search of aggregated field values.
My basic user story (I use the Java API):
Class A{
String organization;
… and 5 more member fields that should be indexed but are irrelevant
for this story
}
We have 10K entities of type A with various values indexed.
Now the user wants to search for organizations by matching the string
“micro” to field organization (field query). He does not care about
entities of type A, he only wants an ordered list or strings,
representing the relevant values submitted in the organization field
for the matched entities.
For example, he might expect as result such as:
“Microsoft”
“Micro – Tech”
“Trend Micro”
…
How do I do that with elastic search? I read the site and didn't find
an answer.
Another story is when the user is still searching for organization
values, but is using a field query on another field in type A.
Disclaimer: Do not use "*" or "?" before "micro" or it will hurt the
performance. Also, you need to make the field "organization" analyzed (you
can try the default standard to begin the test)
I forgot to add that you can manage the result to be narrowed down to only
one field instead of the entire document. However, you still need to
de-serialize the returned result set into proper objects (a set of strings
or a set of objects).
Ali
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.