elastic/elasticsearch · error · IllegalArgumentException
Member method [{}] does not exist for geo field [{}].
Error message
Member method [{}] does not exist for geo field [{}]. What it means
Thrown by the lang-expression script engine when an expression calls a member method on a geo_point field that is not supported. Geo fields expose exactly three methods: 'isEmpty()', 'getLat()', and 'getLon()'. Any other method invocation on doc['<geo_field>'].<method>() hits this default branch.
Source
Thrown at modules/lang-expression/src/main/java/org/elasticsearch/script/expression/GeoField.java:48
static final String GETLON_METHOD = "getLon";
static DoubleValuesSource getVariable(IndexFieldData<?> fieldData, String fieldName, String variable) {
return switch (variable) {
case EMPTY_VARIABLE -> new GeoEmptyValueSource(fieldData);
case LAT_VARIABLE -> new GeoLatitudeValueSource(fieldData);
case LON_VARIABLE -> new GeoLongitudeValueSource(fieldData);
default -> throw new IllegalArgumentException(
"Member variable [" + variable + "] does not exist for geo field [" + fieldName + "]."
);
};
}
static DoubleValuesSource getMethod(IndexFieldData<?> fieldData, String fieldName, String method) {
return switch (method) {
case ISEMPTY_METHOD -> new GeoEmptyValueSource(fieldData);
case GETLAT_METHOD -> new GeoLatitudeValueSource(fieldData);
case GETLON_METHOD -> new GeoLongitudeValueSource(fieldData);
default -> throw new IllegalArgumentException(
"Member method [" + method + "] does not exist for geo field [" + fieldName + "]."
);
};
}
}
View on GitHub (pinned to db6a809a66)
Solutions
- Use only getLat(), getLon(), or isEmpty() as methods on geo_point fields
- If you prefer variable-style access without parentheses, use doc['location'].lat / .lon / .empty
- For geo distance calculations, use a painless script or the geo_distance query/aggregation
- Verify the field type with GET <index>/_mapping — this error only applies to geo_point fields
Example fix
// before — expression script source: doc['location'].getAltitude() // after — use a supported method: doc['location'].getLat()
Defensive patterns
Strategy: validation
Validate before calling
// Validate expression script geo field methods before submission
Set<String> GEO_METHODS = Set.of("isEmpty", "getLat", "getLon");
// extract method name from doc['field'].<method>() and check membership Prevention
- Geo methods require parentheses: doc['field'].getLat(), not doc['field'].getLat
- Only three methods exist: isEmpty(), getLat(), getLon()
- Prefer variable syntax (.lat, .lon) for readability when you don't need method form
When it happens
Trigger: Writing an expression script that calls an unsupported method on a geo_point field. Example: doc['location'].getAltitude() or doc['location'].distance(). The method name is parsed by VariableContext as a METHOD-type context part and routed to GeoField.getMethod when the field type is GeoPointFieldType.
Common situations: Expecting geo helper methods like distanceTo, within, or getGeohash that do not exist in the expression engine. Confusing the expression language's limited geo API with painless's richer API. Copying method names from date fields (e.g., getYear) onto geo fields.
Related errors
- Member variable [{}] does not exist for geo field [{}].
- Member variable [{}] does not exist for numeric field [{}].
- Member method [{}] does not exist for numeric field [{}].
- Member variable [{}] does not exist for date field [{}].
- Member method [{}] does not exist for date field [{}].
AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12).
Data as JSON: /api/errors/f2858eebdd451349.
Report an issue: GitHub.