When I am running a query in elasticsearch I am facing a error
#! Deprecation: returning default values for missing document values is deprecated. Set system property '-Des.scripting.exception_for_missing_value=true' to make behaviour compatible with future major versions!
when I am changing the value in the jvm.option(-Des.scripting.exception_for_missing_value=true) than I am facing the error while running the query the error after changing the option is:
Before changing the value in jvm.option kibana is running perfectly but after changing the value it is throwing an error for the scripted field
I am using 6.5 version of elastic
I think the part of the script missing a check is: doc['mode'].value. Checking for doc[mode].size() > 0 before accessing .value should fix it and thus make the script 7.0 compatible.
Request to Elasticsearch failed: {"error":{"root_cause":[{"type":"script_exception","reason":"runtime error","script_stack":["org.elasticsearch.index.fielddata.ScriptDocValues$Strings.getValue(ScriptDocValues.java:742)","x = doc['mode'].value;\ndef "," ^---- HERE"],"script":"def x = doc['mode'].value;\ndef y = "+515";\ndef z = "515";\nif (x==y){\nreturn z;\n}\nelse {\nreturn x;\n}","lang":"painless"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"custom_received","node":"_wG9HMKKTQiDVyPaDhZ6aQ","reason":{"type":"script_exception","reason":"runtime error","script_stack":["org.elasticsearch.index.fielddata.ScriptDocValues$Strings.getValue(ScriptDocValues.java:742)","x = doc['mode'].value;\ndef "," ^---- HERE"],"script":"def x = doc['mode'].value;\ndef y = "+515";\ndef z = "515";\nif (x==y){\nreturn z;\n}\nelse {\nreturn x;\n}","lang":"painless","caused_by":{"type":"illegal_state_exception","reason":"A document doesn't have a value for a field! Use doc[].size()==0 to check if a document is missing a field!"}}}]},"status":500}
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.