I'm trying to create a script_field by looping over an array of
values. This works
great with arrays with only ordinary items (e.g. integers or strings)
but I can't figure out how to loop over an array
of objects with properties.
When I try to loop over an array of objects I get this error back:
CompileException[[Error: No field found for [weights]]\n[Near : {...
tmp = ''; for(item : doc['weig ....}]\n
^\n[Line: 1, Column: 1]]; nested:
ElasticSearchIllegalArgumentException[No field found for [weights]];
My example code, requests and return values can be found here:
If you are using doc[...] notation, then it loads up the indexed terms from
the Lucene index, in this case, you need to point to actual field elements
indexed in Lucene, for example: weights.lang. Note, if you use
script_fields, it makes little sense to use the doc notation cause it will
cause all values to be loaded, use _source.weights which will load the
_source of the relevant hit and parse it.
On Thu, Dec 1, 2011 at 10:51 AM, Patrik Johansson <
patrik.j.johansson@kentor.se> wrote:
Hi!
I'm trying to create a script_field by looping over an array of
values. This works
great with arrays with only ordinary items (e.g. integers or strings)
but I can't figure out how to loop over an array
of objects with properties.
When I try to loop over an array of objects I get this error back:
CompileException[[Error: No field found for [weights]]\n[Near : {...
tmp = ''; for(item : doc['weig ....}]\n
^\n[Line: 1, Column: 1]]; nested:
ElasticSearchIllegalArgumentException[No field found for [weights]];
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.