Cannot set both mode and enabled parameters – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 8.4-8.9

Briefly, this error occurs when you try to set both [mode] and [enabled] parameters in the Elasticsearch settings simultaneously. These parameters are mutually exclusive, meaning you can only use one at a time. To resolve this issue, you should only use either the [mode] or [enabled] parameter in your settings, not both. Check your configuration and remove or comment out one of the parameters. Then, restart Elasticsearch to apply the changes.

This guide will help you check for common problems that cause the log ” Cannot set both [mode] and [enabled] parameters ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: index.

Log Context

Log “Cannot set both [mode] and [enabled] parameters” class name is SourceFieldMapper.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 public SourceFieldMapper build() {
 if (enabled.getValue().explicit() && mode.get() != null) {
 if (indexMode == IndexMode.TIME_SERIES) {
 throw new MapperParsingException("Time series indices only support synthetic source");
 } else {
 throw new MapperParsingException("Cannot set both [mode] and [enabled] parameters");
 }
 }
 if (isDefault()) {
 return indexMode == IndexMode.TIME_SERIES ? TSDB_DEFAULT : DEFAULT;
 }

 

 [ratemypost]