Failed to parse More Like This item neither id nor doc is specified – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 7.16-8.9

Briefly, this error occurs when Elasticsearch’s More Like This (MLT) query is used without specifying either the ‘id’ or ‘doc’ parameter. MLT query requires one of these parameters to identify the document(s) to be used as the basis for finding similar documents. To resolve this issue, you can either specify the ‘id’ of an existing document or provide a ‘doc’ parameter with the document’s content. Make sure the document exists in the case of ‘id’, and for ‘doc’, ensure the content is correctly formatted.

This guide will help you check for common problems that cause the log ” failed to parse More Like This item. neither [id] nor [doc] is specified! ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: query, index.

Log Context

Log “failed to parse More Like This item. neither [id] nor [doc] is specified!” class name is MoreLikeThisQueryBuilder.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 throw new ElasticsearchParseException(
 "failed to parse More Like This item. either [id] or [doc] can be specified; but not both!"
 );
 }
 if (item.id == null && item.doc == null) {
 throw new ElasticsearchParseException("failed to parse More Like This item. neither [id] nor [doc] is specified!");
 }
 return item;
 }  @Override

 

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?