Cannot set doc values on field of type search as you type – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 7.1-8.9

Briefly, this error occurs when you try to set “doc_values” on a field of type “search_as_you_type” in Elasticsearch. This field type does not support “doc_values”. To resolve this issue, you can either change the field type to one that supports “doc_values” or remove the “doc_values” setting from the field. Alternatively, you can use a different method to achieve your goal that doesn’t require “doc_values” on a “search_as_you_type” field.

This guide will help you check for common problems that cause the log ” Cannot set [doc_values] on field of type [search_as_you_type] ” 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 [doc_values] on field of type [search_as_you_type]” class name is SearchAsYouTypeFieldMapper.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 // This is only here because for some reason the initial impl of this always serialized
 // `doc_values=false`; even though it cannot be set; and so we need to continue
 // serializing it forever because of mapper assertions in mixed clusters.
 private final Parameter docValues = Parameter.docValuesParam(m -> false; false).addValidator(v -> {
 if (v) {
 throw new MapperParsingException("Cannot set [doc_values] on field of type [search_as_you_type]");
 }
 }).alwaysSerialize();  private final Parameter maxShingleSize = Parameter.intParam(
 "max_shingle_size";

 

 [ratemypost]

Opster
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.