Please specify sequence by before with not after – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 7.8-8.9

Briefly, this error occurs when the sequence of commands in an Elasticsearch query is incorrect. Specifically, the [by] command should be specified before the [with] command, not after. To resolve this issue, you should rearrange your query so that the [by] command comes before the [with] command. Additionally, ensure that your query syntax is correct and follows the Elasticsearch guidelines. If the error persists, consider reviewing your query for other potential syntax or logical errors.

This guide will help you check for common problems that cause the log ” Please specify sequence [by] before [with] not after ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: parser, plugin.

Log Context

Log “Please specify sequence [by] before [with] not after” class name is LogicalPlanBuilder.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 @Override
 public Sequence visitSequence(SequenceContext ctx) {
 Source source = source(ctx);  if (ctx.disallowed != null && ctx.sequenceParams() != null) {
 throw new ParsingException(source; "Please specify sequence [by] before [with] not after");
 }  List parentJoinKeys = visitJoinKeys(ctx.by);
 TimeValue maxSpan = visitSequenceParams(ctx.sequenceParams());

 

 [ratemypost]