Hi, I have a requirement to form a script query from java code where it has to formulate the final score after getting the elastic score plus referring a variable on the runtime.
There will be many documents like below. I am not indexing the grades field as it will have various numbers of users and can explode the mapping limits. On runtime I want the score to be combination as below
Without indexing , I can get it through _source , but _source lookup is very slow and it is resulting in perfromance bottlenecks
have tried through doc and field lookup, they are fast , but they need ranking.grades fields to be indexed. Down side of this is as the names cannot have any limit, as soon as some 1000 names (mapping default limit) are indexed , the next insertion starts failing.
I am looking for some way where I can access the value without getting it indexed but not at the cost of high latency.
What does your mapping looks like? You may map the grades field as flattened, this will avoid the mapping explosion.
From the documentation:
This data type can be useful for indexing objects with a large or unknown number of unique keys. Only one field mapping is created for the whole JSON object, which can help prevent a mappings explosion from having too many distinct field mappings.
Not sure if I got the issue, but every child in the flattened field will be mapped as keyword, so if you want to work with them as numbers you will probably need to convert it in your script.
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.