The version field is not searchable – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-8.9

Briefly, this error occurs when you try to search using the _version field in Elasticsearch. The _version field is a system field that keeps track of the version number of the document and is not searchable. To resolve this issue, you can create a custom field to store your version information and make it searchable. Alternatively, you can use the _seq_no and _primary_term fields for optimistic concurrency control, which are searchable.

This guide will help you check for common problems that cause the log ” The _version field is not searchable ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: index.

Log Context

Log “The _version field is not searchable” class name is VersionFieldMapper.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 return CONTENT_TYPE;
 }  @Override
 public Query termQuery(Object value; SearchExecutionContext context) {
 throw new QueryShardException(context; "The _version field is not searchable");
 }  @Override
 public ValueFetcher valueFetcher(SearchExecutionContext context; String format) {
 return new DocValueFetcher(docValueFormat(format; null); context.getForField(this; FielddataOperation.SEARCH));

 

 [ratemypost]