Nested path has been removed in favour of the nested parameter – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 8-8.9

Briefly, this error occurs when you’re using the outdated [nested_path] parameter in your Elasticsearch query. Elasticsearch has deprecated this parameter in favour of the [nested] parameter. To resolve this issue, you should replace [nested_path] with [nested] in your query. Also, ensure that the structure of your query aligns with the new [nested] parameter requirements. This change should resolve the error and allow your query to execute successfully.

This guide will help you check for common problems that cause the log ” [nested_path] has been removed in favour of the [nested] parameter ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: sort, search.

Log Context

Log “[nested_path] has been removed in favour of the [nested] parameter” class name is ScriptSortBuilder.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 PARSER.declareString((b; v) -> b.order(SortOrder.fromString(v)); ORDER_FIELD);
 PARSER.declareString((b; v) -> b.sortMode(SortMode.fromString(v)); SORTMODE_FIELD);
 PARSER.declareObject(ScriptSortBuilder::setNestedSort; (p; c) -> NestedSortBuilder.fromXContent(p); NESTED_FIELD);  PARSER.declareObject((b; v) -> {}; (p; c) -> {
 throw new ParsingException(p.getTokenLocation(); "[nested_path] has been removed in favour of the [nested] parameter"; c);
 }; NESTED_PATH_FIELD);  PARSER.declareObject((b; v) -> {}; (p; c) -> {
 throw new ParsingException(p.getTokenLocation(); "[nested_filter] has been removed in favour of the [nested] parameter"; c);
 }; NESTED_FILTER_FIELD);

 

 [ratemypost]