Script query does not support currentFieldName – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-8.9

Briefly, this error occurs when an unsupported field is used in a script query in Elasticsearch. The field mentioned in the error message is not recognized by Elasticsearch. To resolve this issue, you should first verify the field name in your query. Make sure it matches exactly with the field name in your Elasticsearch index, including case sensitivity. If the field name is correct, check if the field is searchable and not excluded from the index. Lastly, ensure that the field is of a type that can be used in a script query.

This guide will help you check for common problems that cause the log ” [script] query does not support [” + currentFieldName + “] ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: query, index.

Log Context

Log “[script] query does not support [” + currentFieldName + “]” class name is ScriptQueryBuilder.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 currentFieldName = parser.currentName();
 } else if (token == XContentParser.Token.START_OBJECT) {
 if (Script.SCRIPT_PARSE_FIELD.match(currentFieldName; parser.getDeprecationHandler())) {
 script = Script.parse(parser);
 } else {
 throw new ParsingException(parser.getTokenLocation(); "[script] query does not support [" + currentFieldName + "]");
 }
 } else if (token.isValue()) {
 if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName; parser.getDeprecationHandler())) {
 queryName = parser.text();
 } else if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName; parser.getDeprecationHandler())) {

 

 [ratemypost]