Number format exception for geo_point field

Hi, in elasticsearch log file, we often see this

[2019-10-01 09:39:10,694][INFO ][rest.suppressed          ] /my_index/my_type/1569915520584.1689070526/_update Params: {version_type=force, doc_as_upsert=true, index=my_index, op_type=create, id=1569915520584.1689070526, type=my_type, consistency=one, version=1569915550527, ttl=8121600000ms, detect_noop=false}
RemoteTransportException[[node06][1.2.3.4:9300][indices:data/write/update[s]]]; nested: MapperParsingException[failed to parse [geo_location]]; nested: NumberFormatException[For input string: "33.927704,-118.2034"];
Caused by: MapperParsingException[failed to parse [geo_location]]; nested: NumberFormatException[For input string: "33.927704,-118.2034"];
	at org.elasticsearch.index.mapper.FieldMapper.parse(FieldMapper.java:343)
	at org.elasticsearch.index.mapper.DocumentParser.parseObjectOrField(DocumentParser.java:318)
	at org.elasticsearch.index.mapper.DocumentParser.parseAndMergeUpdate(DocumentParser.java:765)
	at org.elasticsearch.index.mapper.DocumentParser.parseDynamicValue(DocumentParser.java:652)
	at org.elasticsearch.index.mapper.DocumentParser.parseValue(DocumentParser.java:451)
	at org.elasticsearch.index.mapper.DocumentParser.parseObject(DocumentParser.java:271)
	at org.elasticsearch.index.mapper.DocumentParser.innerParseDocument(DocumentParser.java:131)
	at org.elasticsearch.index.mapper.DocumentParser.parseDocument(DocumentParser.java:79)
	at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:304)
	at org.elasticsearch.index.shard.IndexShard.prepareIndex(IndexShard.java:580)
	at org.elasticsearch.index.shard.IndexShard.prepareIndexOnPrimary(IndexShard.java:559)
	at org.elasticsearch.action.index.TransportIndexAction.prepareIndexOperationOnPrimary(TransportIndexAction.java:211)
	at org.elasticsearch.action.index.TransportIndexAction.executeIndexRequestOnPrimary(TransportIndexAction.java:223)
	at org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:157)
	at org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:65)
	at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryPhase.doRun(TransportReplicationAction.java:595)
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
	at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryOperationTransportHandler.messageReceived(TransportReplicationAction.java:263)
	at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryOperationTransportHandler.messageReceived(TransportReplicationAction.java:260)
	at org.elasticsearch.transport.TransportService$4.doRun(TransportService.java:350)
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NumberFormatException: For input string: "33.927704,-118.2034"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Long.parseLong(Long.java:589)
	at java.lang.Long.parseLong(Long.java:631)
	at org.elasticsearch.common.xcontent.support.AbstractXContentParser.longValue(AbstractXContentParser.java:145)
	at org.elasticsearch.index.mapper.core.LongFieldMapper.innerParseCreateField(LongFieldMapper.java:275)
	at org.elasticsearch.index.mapper.core.NumberFieldMapper.parseCreateField(NumberFieldMapper.java:241)
	at org.elasticsearch.index.mapper.FieldMapper.parse(FieldMapper.java:335)
	... 23 more

We checked, the mapping for field geo_location is having type of geo_point. We are using elasticsearch 2.2.1.

We try to reproduce this by index a new document and update the same document, we are unable to reproduce. However, the above exception if found from elasticsearch log file from time to time.

Can anyone tell how to reproduce this and why is this happening?

Thank you.

Jason

first, please upgrade your elasticsearch version. This version is well over 3.5 years old and this is missing not only a ton of features, but more importantly a ton of bugfixes...

second, is it possible that the mapping for this field is a number (despite it's name) and thus it cannot be parsed as a geo point. Please check the mapping of the index. Thanks!

Hi Alexander,

can you specify which version that fix the exception I shown above?

I have specified in my initial post, the field geo_location is using geo_point type.

then please provide a full reproduction containing index creation, mapping setup and document storage for others to reproduce your issue.

Thanks!

Unfortunately I have tried to reproduce but was unable to reproduce in the testing environment. This only happen in production. Sure, I can give you the steps.

curl -XPUT 'http://localhost:9200/my_index/?pretty' -d '{
"settings" : {
"number_of_shards" : '5',
"number_of_replicas" : '2'
},
"mappings" : {
"my_type" : {
"_ttl" : { "enabled" : true, "default" : 64800000000},
"_parent": {
"type": "user"
},
"_routing": {
"required": true
},
"properties": {
"geo_location": {
"type": "geo_point",
"fields": {
"raw": {
"type": "string",
"index": "not_analyzed"
}
}
},
}
},
"user" : {
"_ttl" : { "enabled" : true, "default" : 64800000000},
"properties": {
"count": {
"type": "string",
"fields": {
"count_long": {
"type": "long"
}
}
}
}
}
}
}'

$ curl -XPOST 'http://localhost:9200/my_index/my_type/s1?routing=u1' -d '{
>   "geo_location" : {
>       "lat": 41.12,
>       "lon": -71.34
>   }
> }'
{"_index":"my_index","_type":"my_type","_id":"s1","_version":1,"_shards":{"total":1,"successful":1,"failed":0},"created":true}



$  curl -XPOST 'http://localhost:9200/my_index/my_type/s2?routing=u2' -d '{
>    "geo_location" : "41.12,-71.34"
>  }'
{"_index":"my_index","_type":"my_type","_id":"s2","_version":1,"_shards":{"total":1,"successful":1,"failed":0},"created":true}



$ curl -XPOST 'http://localhost:9200/my_index/my_type/s3?routing=u3' -d '{
>     "geo_location" : ["41.12, -71.34"]
>   }'
{"_index":"my_index","_type":"my_type","_id":"s3","_version":1,"_shards":{"total":1,"successful":1,"failed":0},"created":true}

curl -XPOST 'http://localhost:9200/my_index/my_type/s4?routing=u4' -d '{
     "geo_location" : "43.757004,-71.6881"
}' 

$ curl -XPOST 'http://localhost:9200/my_index/my_type/s4?routing=u4' -d '{
>      "geo_location" : "43.757004,-71.6881"
>    }' 
{"_index":"my_index","_type":"my_type","_id":"s4","_version":1

I mentioned in my initial post that I have tried that locally but was unable to reproduce locally and thus unable to find out the problem. Perhaps the best question is , what are the way to find out the exception in production?

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