I'm trying to index a document with a valid "geo_point" data, but I got an error saying "geo_point expected". Can someone please advise?
Request:
curl -X PUT "10.80.0.78:9200/production-index/mytype/mydocument1?pretty" -H 'Content-Type: application/json' -d'{"account":"170/170/653","location":[-74.104158,41.053954]}'
Output:
{
"error" : {
"root_cause" : [
{
"type" : "parse_exception",
"reason" : "geo_point expected"
}
],
"type" : "mapper_parsing_exception",
"reason" : "failed to parse field [location] of type [geo_point]",
"caused_by" : {
"type" : "parse_exception",
"reason" : "geo_point expected"
}
},
"status" : 400
}
Can you try POST instead of PUT?
@Ignacio_Vera
I still receive the same error
curl -X POST "10.80.0.78:9200/production-listings/listings/mydocument1?pretty" -H 'Content-Type: application/json' -d'{"account":"170/170/653","location":[-74.104158,41.053954]}'
Unfortunately I cannot reproduce it, could you provide the mapping you are using?
stephenb
(Stephen Brown)
September 28, 2019, 4:03pm
6
7.0+ must use the _doc
type.... that is the issue I believe (Removal of types )
I just put in your mapping then posted the document, I think you have a leftover type listings
in the URL
curl -X POST "localhost:9200/production-listings/_doc/mydocument1?pretty" -H 'Content-Type: application/json' -d'{"account":"170/170/653","location": [ -74.104158, 41.053954] }'
Oh an just for clarity sake POST with providing document id is not really correct ...
PUT with _id POST without so should be
curl -X POST "localhost:9200/production-listings/_doc?pretty" -H 'Content-Type: application/json' -d'{"account":"170/170/653","location": [ -74.104158, 41.053954] }'
or
curl -X PUT "localhost:9200/production-listings/_doc/mydocument1?pretty" -H 'Content-Type: application/json' -d'{"account":"170/170/653","location": [ -74.104158, 41.053954] }
Tested both worked
1 Like
you can validate your JSON data at https://jsonformatter.org
system
(system)
Closed
November 1, 2019, 9:11am
9
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.