Attempt to put missing mapping in indices – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-7.15

Briefly, this error occurs when you try to update or add a mapping to an index in Elasticsearch that doesn’t exist. Elasticsearch requires the index to be present before a mapping can be added. To resolve this issue, you can either create the index before adding the mapping or use an index template. An index template will automatically apply the mapping to new indices that match the template’s pattern. Alternatively, you can use the ‘create index’ API with the mapping included in the request.

This guide will help you check for common problems that cause the log ” Attempt to put missing mapping in indices ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin, indices, mapping.

Log Context

Log “Attempt to put missing mapping in indices” class name is ElasticsearchMappings.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 executeAsyncWithOrigin(client; ML_ORIGIN; PutMappingAction.INSTANCE; putMappingRequest;
 ActionListener.wrap(response -> {
 if (response.isAcknowledged()) {
 listener.onResponse(true);
 } else {
 listener.onFailure(new ElasticsearchException("Attempt to put missing mapping in indices "
 + Arrays.toString(indicesThatRequireAnUpdate) + " was not acknowledged"));
 }
 }; listener::onFailure));
 } catch (IOException e) {
 listener.onFailure(e);

 

 [ratemypost]