apache/seatunnel · warning
fail to get elasticsearch field
Error message
fail to get elasticsearch field {} mapping type,so give a default type text What it means
When building the field-type map for an Elasticsearch index, a field name referenced in the query/source was not found in the fetched index mapping. The client logs this warning and falls back to a default BasicTypeDefine of type 'text', which may cause inaccurate type mapping downstream.
Solutions
- Verify the field exists in the index mapping (GET /index/_mapping)
- Fix the field name spelling in the source config
- Ensure all indices in index_list share consistent mappings or declare schema explicitly via source config
- Accept the fallback and explicitly map the field type using the schema/source option
Example fix
// before
source = ["my_field"] // field missing in mapping -> defaults to text
// after
source {
MyTable {
schema = {
fields {
my_field = string
}
}
}
} Defensive patterns
Strategy: validation
Validate before calling
// verify fields exist in mapping before reading curl -s 'http://es:9200/my_index/_mapping' | jq '.my_index.mappings.properties | keys'
Prevention
- Cross-check source field names against GET /_mapping
- Declare fields explicitly via source/schema config for heterogeneous indices
- Avoid relying on fallback text typing for numeric/date fields
When it happens
Trigger: Reading from an index where a requested field is absent from the mapping (e.g. nested/object fields, fields only present in some documents, runtime fields, or alias/multi-index reads where mappings differ).
Common situations: Typo in source field name; reading across multiple indices with heterogeneous mappings; dynamic mapping not yet created; fields mapped only via runtime fields.
Related errors
- ES_FIELD_TYPE_NOT_SUPPORT
- ADD_FIELD_FAILED
- Attempted to clear scroll with empty scroll ID
- Avro format doesn't support non-string as key type of map…
- BULK_RESPONSE_ERROR
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/21333f23b27de3cf.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/client/EsRestClient.java:836
BasicTypeDefine<EsType> type =
allElasticSearchFieldTypeInfoMap.get(
fieldType.getNativeType().getOptions().get("path"));
if (type != null) {
allElasticSearchFieldTypeInfoMap.put(fieldName, type);
}
}
});
return source.stream()
.collect(
Collectors.toMap(
Function.identity(),
fieldName -> {
BasicTypeDefine<EsType> fieldType =
allElasticSearchFieldTypeInfoMap.get(fieldName);
if (fieldType == null) {
log.warn(
"fail to get elasticsearch field {} mapping type,so give a default type text",
fieldName);
return BasicTypeDefine.<EsType>builder()
.name(fieldName)
.columnType("text")
.dataType("text")
.build();
}
return fieldType;
}));
}
/**
* Add a new field to an existing index
*
* @param index index name
* @param fieldTypeDefine field type definition
*/
public void addField(String index, BasicTypeDefine<EsType> fieldTypeDefine) {View on GitHub (pinned to cf67b549a7)