Unsupported zero terms docs value zeroTermsDocs – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-6.8

Briefly, this error occurs when an invalid value is passed to the “zero_terms_docs” parameter in Elasticsearch. This parameter is used in match queries and it determines what to do when no terms are found. The valid values are “none” and “all”. If any other value is passed, this error will occur. To resolve this issue, ensure that the value passed to “zero_terms_docs” is either “none” or “all”. If the parameter is not necessary for your query, consider removing it altogether.

This guide will help you check for common problems that cause the log ” Unsupported zero_terms_docs value [” + zeroTermsDocs + “] ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: index, query.

Log Context

Log “Unsupported zero_terms_docs value [” + zeroTermsDocs + “]” class name is MultiMatchQueryBuilder.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 if ("none".equalsIgnoreCase(zeroTermsDocs)) {
 zeroTermsQuery = MatchQuery.ZeroTermsQuery.NONE;
 } else if ("all".equalsIgnoreCase(zeroTermsDocs)) {
 zeroTermsQuery = MatchQuery.ZeroTermsQuery.ALL;
 } else {
 throw new ParsingException(parser.getTokenLocation(); "Unsupported zero_terms_docs value [" + zeroTermsDocs + "]");
 } else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName; parser.getDeprecationHandler())) {
 queryName = parser.text();
 } else if (GENERATE_SYNONYMS_PHRASE_QUERY.match(currentFieldName; parser.getDeprecationHandler())) {
 autoGenerateSynonymsPhraseQuery = parser.booleanValue();