# Detect invalid latitude and longitude values in an index

**URL:** <https://discuss.elastic.co/t/detect-invalid-latitude-and-longitude-values-in-an-index/211687>\
**Category:** Elasticsearch\
**Created:** [December 12, 2019, 4:18pm UTC](https://discuss.elastic.co/t/detect-invalid-latitude-and-longitude-values-in-an-index/211687 "2019-12-12T16:18:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mateo\_Loaiza\_Rios](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mateo_loaiza_rios/32/59288_2.png) [@Mateo\_Loaiza\_Rios](https://discuss.elastic.co/u/Mateo_Loaiza_Rios)\
**Post date:** [December 12, 2019, 4:18pm UTC](https://discuss.elastic.co/t/detect-invalid-latitude-and-longitude-values-in-an-index/211687/1 "2019-12-12T16:18:00Z")

</div>

I am trying to detect by means of a regular expression if the latitude and longitude fields are not valid, but it does not work for me. At this time the values of these 2 fields are string. I was trying to merge latitude and longitude to a single latlng field and then change to the geo\_point data type to make queries based on latitude and longitude. Can someone help me with this?

Mapping fields

```
"latitude": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },"longitude": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },"latlng": {
            "type": "geo_point"
          }

```

Error example

This error is returned at the time of merging latitude and longitude to a single latlng type geo\_point field

```
    "type": "mapper_parsing_exception",
            "reason": "failed to parse",
            "caused_by": {
              "type": "illegal_argument_exception",
              "reason": "illegal longitude value [-435.635894775391] for latlng"
            }
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 9, 2020, 4:18pm UTC](https://discuss.elastic.co/t/detect-invalid-latitude-and-longitude-values-in-an-index/211687/2 "2020-01-09T16:18:03Z")

</div>

Closed on January 9, 2020, 4:18pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
