A sample requires a minimum of 2 queries found – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 8.6-8.9

Briefly, this error occurs when Elasticsearch’s Rank Evaluation API is used with less than two queries. The Rank Evaluation API requires at least two queries to compare their results and rank them. To resolve this issue, ensure that you are providing at least two queries when using the Rank Evaluation API. If you are dynamically generating queries, add checks to ensure that at least two queries are generated.

This guide will help you check for common problems that cause the log ” A sample requires a minimum of 2 queries; found [{}] ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: parser, plugin.

Log Context

Log “A sample requires a minimum of 2 queries; found [{}]” class name is LogicalPlanBuilder.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 throw new ParsingException(src; "Join keys must be used only once; found duplicates: [{}]"; duplicates.toString());
 }
 }  if (queries.size() < 2) {
 throw new ParsingException(source; "A sample requires a minimum of 2 queries; found [{}]"; queries.size());
 }  if (hasMissingJoinKeys) {
 throw new ParsingException(missingJoinKeysSource; "A sample must have at least one join key; found none");
 }

 

How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?