BadRequest400Exception latitude must be a number

Hi All,

I got an error:

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

'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

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

Elastic

{
  "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,

Please don't use 6.2, it's well beyond EOL and no longer supported.

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

Do I have any risk to upgrade elastic?

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

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