I have a similar problem but the solution provided here is not working.
Under custom script, I have this:
"script" : "(doc.containsKey("my_field") ? doc['my_field].value : 0)"
This fails on doc['my_field].value apprently, with the exception:
Query Failed [Failed to execute main query]]; nested:
PropertyAccessException[[Error: could not access: value; in class:
org.elasticsearch.index.fielddata.ScriptDocValues$Empty [Near : {... value
....}]
In the index document mapping i see that my_field has a valid entry. Is
that the reason why "containsKey" its returning true? The field is
defintely not in my document, which is what causing the issue.
Any way I could make the script work?
On Friday, November 2, 2012 7:59:49 AM UTC-7, Amy wrote:
Hi,
I have a mvel scoring script that refers to a field:
"(doc['myfield'].value == '1') ? 1 : 0)"
None of the documents in the type that I am searching have this field yet.
When I perform a search that includes this script I get a
QueryPhaseExecutionException:
ElasticSearchIllegalArgumentException[No field found for [myfield] in
mapping with types [type]];
As a workaround, whenever I add a document to a new type that I want to
search I have to add an 'initialiser' document that contains all the fields
referred to in my scoring script.
Is there a better way?
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.