# BadRequest400Exception latitude must be a number

**URL:** <https://discuss.elastic.co/t/badrequest400exception-latitude-must-be-a-number/293169>\
**Category:** Elasticsearch\
**Created:** [December 30, 2021, 3:45am UTC](https://discuss.elastic.co/t/badrequest400exception-latitude-must-be-a-number/293169 "2021-12-30T03:45:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rayuth](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rayuth/32/99683_2.png) [@rayuth](https://discuss.elastic.co/u/rayuth)\
**Post date:** [December 30, 2021, 3:45am UTC](https://discuss.elastic.co/t/badrequest400exception-latitude-must-be-a-number/293169/1 "2021-12-30T03:45:08Z")

</div>

Hi All,

I got an error:

```auto
Elasticsearch\Common\Exceptions\BadRequest400Exception: {"error":{"root_cause":[{"type":"parse_exception","reason":"latitude must be a number"}],"type":"mapper_parsing_exception","reason":"failed to parse","caused_by":{"type":"parse_exception","reason":"latitude must be a number"}},"status":400}

```

Mapping

```auto
'location' => [
    'properties' => [
        'latitude' => [
            'type' => 'float',
            'fields' => [
                'raw' => [
                    'type' => 'float',
                ]
            ]
        ],
        'longitude' => [
            'type' => 'float',
            'fields' => [
                'raw' => [
                    'type' => 'float',
                ]
            ]
        ],
    ]
],
.....
'pin' => [
    'properties' => [
        'location' => [
            'type' => 'geo_point',
        ]
    ]
],

```

Get the indexable data array for the model

```auto
'pin' => [
    'location' => [
        'lat' => $this->latitude,
        'lon' => $this->longitude,
    ]
]

```

Elastic

```auto
{
  "name" : "...",
  "cluster_name" : "laradock-cluster",
  "cluster_uuid" : "...",
  "version" : {
    "number" : "6.2.3",
    "build_hash" : "...",
    "build_date" : "2018-03-13T10:06:29.741383Z",
    "build_snapshot" : false,
    "lucene_version" : "7.2.1",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

```

The **longitude** and **latitude** are **float**. I think because of **NULL** issue. Anyway I need to have **NULL** value for **geopoint**.  
Do you have any solution for this issue?

Thank you,

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [December 30, 2021, 5:10am UTC](https://discuss.elastic.co/t/badrequest400exception-latitude-must-be-a-number/293169/2 "2021-12-30T05:10:59Z")

</div>

Please don't use 6.2, it's well beyond [EOL](https://www.elastic.co/support/eol) and no longer supported.

> [@rayuth](#):
>
> Anyway I need to have **NULL** value for **geopoint**.

That's not valid, which is why you are getting the error. You need to pass in something.

---

<div class="post-metadata">

**Author:** ![rayuth](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rayuth/32/99683_2.png) [@rayuth](https://discuss.elastic.co/u/rayuth)\
**Post date:** [December 31, 2021, 4:22am UTC](https://discuss.elastic.co/t/badrequest400exception-latitude-must-be-a-number/293169/3 "2021-12-31T04:22:30Z")

</div>

Do I have any risk to upgrade elastic?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 4, 2022, 5:48am UTC](https://discuss.elastic.co/t/badrequest400exception-latitude-must-be-a-number/293169/4 "2022-01-04T05:48:52Z")

</div>

There's always a risk upgrading anything. As long as you follow the recommendations you should be relatively safe though.

---

<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:** [February 1, 2022, 5:49am UTC](https://discuss.elastic.co/t/badrequest400exception-latitude-must-be-a-number/293169/5 "2022-02-01T05:49:34Z")

</div>

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