where widgetNumber: 10 corresponds to the string "foo" and widgetNumber:99
corresponds to the string "bar".
We never need to do text searches on widget, and widget's value may be
updated often, so we keep it normalized.
However, we do want to be able to sort results by widget's value. The
approach I'm trying is to make a lookup table for widget so that the custom
sort script would look like
"n = doc['widgetNumber'].value; return lookup[n];"
where "lookup" is a parameter to the script.
This works as expected, but it requires that you send the lookup table to
ES. Is there a mechanism to store this table in ES for use in the script?
Perhaps it is feasible with some small extensions/plugins?
Failing that, is there a different approach entirely that I should be using?
You can write a plugin that has a custom search script that does that. The
script, on the factory level, can go to the external data that has hte
mapping, and load it to memory, and then do the mapping, refreshing it now
and then. There was a thread on the mailing list that did it and gisted a
great sample for it, can't find it now...
where widgetNumber: 10 corresponds to the string "foo" and widgetNumber:99
corresponds to the string "bar".
We never need to do text searches on widget, and widget's value may be
updated often, so we keep it normalized.
However, we do want to be able to sort results by widget's value. The
approach I'm trying is to make a lookup table for widget so that the custom
sort script would look like
"n = doc['widgetNumber'].value; return lookup[n];"
where "lookup" is a parameter to the script.
This works as expected, but it requires that you send the lookup table to
ES. Is there a mechanism to store this table in ES for use in the script?
Perhaps it is feasible with some small extensions/plugins?
Failing that, is there a different approach entirely that I should be
using?
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.