elasticsearch data_error ai_generated true

MapperParsingException: failed to parse geo_point field [location] - latitude [91.0] must be in range [-90.0, 90.0]

ID: elasticsearch/geo-point-outside-bounds

Also available as: JSON · Markdown · 中文
92%Fix Rate
88%Confidence
1Evidence
2024-03-22First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
elasticsearch 7.10.0 active
elasticsearch 8.5.0 active
elasticsearch 8.11.0 active

Root Cause

A geo_point field contains a latitude or longitude value outside the valid geographic range.

generic

中文

geo_point字段包含超出有效地理范围的纬度或经度值。

Official Documentation

https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-point.html

Workarounds

  1. 95% success Clean the source data before indexing: filter out records where latitude is not between -90 and 90, e.g., using a Logstash mutate filter: filter { mutate { convert => ["latitude", "float"] } if [latitude] < -90 or [latitude] > 90 { drop {} } }
    Clean the source data before indexing: filter out records where latitude is not between -90 and 90, e.g., using a Logstash mutate filter: filter { mutate { convert => ["latitude", "float"] } if [latitude] < -90 or [latitude] > 90 { drop {} } }
  2. 90% success Use a pipeline with a script processor to validate and correct coordinates: PUT _ingest/pipeline/geo_validate { "processors": [ { "script": { "source": "if (ctx.latitude < -90 || ctx.latitude > 90) { ctx.latitude = null }" } } ] }
    Use a pipeline with a script processor to validate and correct coordinates: PUT _ingest/pipeline/geo_validate { "processors": [ { "script": { "source": "if (ctx.latitude < -90 || ctx.latitude > 90) { ctx.latitude = null }" } } ] }
  3. 70% success Set ignore_malformed to true on the geo_point field in the mapping, then filter out malformed documents after indexing using a query.
    Set ignore_malformed to true on the geo_point field in the mapping, then filter out malformed documents after indexing using a query.

中文步骤

  1. 在索引前清洗源数据:过滤掉纬度不在-90到90之间的记录,例如使用Logstash的mutate过滤器:filter { mutate { convert => ["latitude", "float"] } if [latitude] < -90 or [latitude] > 90 { drop {} } }
  2. 使用包含脚本处理器的管道验证并修正坐标:PUT _ingest/pipeline/geo_validate { "processors": [ { "script": { "source": "if (ctx.latitude < -90 || ctx.latitude > 90) { ctx.latitude = null }" } } ] }
  3. 在映射中将geo_point字段的ignore_malformed设为true,然后索引后通过查询过滤掉畸形文档。

Dead Ends

Common approaches that don't work:

  1. 80% fail

    This breaks geo queries and aggregations, and loses spatial functionality.

  2. 50% fail

    This hides the data quality issue and may cause data loss without alerting the user.

  3. 90% fail

    ignore_z_value only ignores altitude, not latitude/longitude range violations.