Problem converting latitude and longitude from jdbc to elastic geo_point using logstash

Hi, having issues running a logstash config which is supposed to convert lat and lon into a field type geo_point

my current config file looks like:

jdbc_user => "elastic"
statement => "SELECT * FROM mChoice_TotalPartnerElasticSearchView"
  }
}

filter {
	mutate {
		add_field => { "[location][lat]" => "%{[lat]}" }
		add_field => { "[location][lon]" => "%{[lon]}" }
	}
 
mutate {
   convert => {
       "[location][lat]" => "float"
       "[location][lon]" => "float" 
    }
}
}
   


output {
  elasticsearch {
hosts => ["localhost:9200"]
index => "totalpartners"
	document_type => "_doc"
	document_id => "%{[partnerid]}"
  }
}

my mapping looks like:

    "properties": {
       "Address": {
          "type": "text"
       },
       "AddressAdd": {
          "type": "text"
       },
       "City": {
          "type": "keyword"
       },
       "Contact": {
          "type": "text"
       },
       "Country": {
          "type": "keyword"
       },
       "EMail": {
          "type": "keyword"
       },
       "Location": {
                "type": "geo_point"
        
       },
       "Name": {
          "type": "completion"
       },
       "NameAdd": {
          "type": "text"
       },

my Error looks like:

[2019-07-03T05:01:53,450][WARN ][logstash.outputs.elasticsearch] Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>"10002", :_index=>"totalpartners", :_type=>"_doc", :routing=>nil}, #<LogStash::Event:0x5661e171>], :response=>{"index"=>{"_index"=>"totalpartners", "_type"=>"_doc", "_id"=>"10002", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse field [location] of type [float]", "caused_by"=>{"type"=>"json_parse_exception", "reason"=>"Current token (START_OBJECT) not numeric, can not use numeric value accessors\n at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper@738ff5d4; line: 1, column: 47]"}}}}}

Running on Elastic 6.7 and logstash 6.7 any help is appreciated.

Best regards

Not sure if this is the problem, but field names are case sensitive. location and Location are different fields.

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