Random score seed must be an int long or string not – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-7.15

Briefly, this error occurs when the ‘random_score’ function in Elasticsearch receives an incorrect data type for the ‘seed’ parameter. The ‘seed’ parameter should be an integer, long, or string, but it has received a different data type. To resolve this issue, you should check the data type of the ‘seed’ parameter in your query and ensure it is either an integer, long, or string. If it’s not, you should convert it to one of these data types before passing it to the ‘random_score’ function.

This guide will help you check for common problems that cause the log ” random_score seed must be an int; long or string; not ‘ ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: index, long, query.

Log Context

Log “random_score seed must be an int; long or string; not ‘” class name is RandomScoreFunctionBuilder.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 if (parser.numberType() == XContentParser.NumberType.INT) {
 randomScoreFunctionBuilder.seed(parser.intValue());
 } else if (parser.numberType() == XContentParser.NumberType.LONG) {
 randomScoreFunctionBuilder.seed(parser.longValue());
 } else {
 throw new ParsingException(parser.getTokenLocation(); "random_score seed must be an int; long or string; not '"
 + token.toString() + "'");
 }
 } else if (token == XContentParser.Token.VALUE_STRING) {
 randomScoreFunctionBuilder.seed(parser.text());
 } else {

 

 [ratemypost]