The source 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 _source field in Elasticsearch. The _source field is a special field that contains the original JSON document that was indexed, but it is not searchable. To resolve this issue, you can either use the fields within the _source field for your search or enable the “store” option for specific fields in your mapping, which makes them searchable. Alternatively, you can use a script field to extract and return the data you need from the _source field.

This guide will help you check for common problems that cause the log ” The _source 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 _source field is not searchable” class name is SourceFieldMapper.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 throw new UnsupportedOperationException("Cannot fetch values for internal field [" + name() + "].");
 }  @Override
 public Query existsQuery(SearchExecutionContext context) {
 throw new QueryShardException(context; "The _source field is not searchable");
 }  @Override
 public Query termQuery(Object value; SearchExecutionContext context) {
 throw new QueryShardException(context; "The _source field is not searchable");

 

 [ratemypost]