Below are the steps I am taking:
Below are the steps I am following to store geo_point
a.) Created index : PUT chicago_crime . - THIS IS TO CREATE INDEX
b.) Geo point mapping: - CREATE A MAPPING WITH a field location with Geo_point Datatype
PUT chicago_crime/_mapping/my_type
{
"my_type": {
"properties": {
"location": {
"type": "geo_point"
}
}
}
}
c.) logstash: - THIS IS THE LOGSTASH conf file
input {
file {
path => "/home/ppunj/chicago-crime.csv"
start_position => 'beginning'
sincedb_path => '/dev/null'
}
}
filter {
csv {
separator => ","
columns => ["id","case","number","date","block","iucr","primary type","description","location description","arrest","domestic","district","ward","community area","year","latitude","longitude"]
}
date {
match => ["date", "MM/dd/yyyy HH:mm"]
target => "date"
locale => "en"
}
mutate {convert => ["latitude", "float"]}
mutate {convert => ["longitude", "float"]}
mutate {
rename => {
"longitude" => "[location][lon]"
"latitude" => "[location][lat]"
}
}
}
output {
elasticsearch {
hosts => "http://localhost:9200"
index => "chicago_crime"
}
stdout {}
}
d.)SAMPLE CSV file
id,case number,date,block,iucr,primary type,description,location description,arrest,domestic,district,ward,community area,year,latitude,longitude
10000092,HY189866,3/18/2015 19:44,047XX W OHIO ST,041A,BATTERY,AGGRAVATED: HANDGUN,STREET,FALSE,FALSE,11,28,25,2015,41.89139886,-87.74438457
10000094,HY190059,3/18/2015 23:00,066XX S MARSHFIELD AVE,4625,OTHER OFFENSE,PAROLE VIOLATION,STREET,TRUE,FALSE,7,15,67,2015,41.77337153,-87.66531947
10000095,HY190052,3/18/2015 22:45,044XX S LAKE PARK AVE,486,BATTERY,DOMESTIC BATTERY SIMPLE,APARTMENT,FALSE,TRUE,2,4,39,2015,41.81386068,-87.59664284
10000096,HY190054,3/18/2015 22:30,051XX S MICHIGAN AVE,460,BATTERY,SIMPLE,APARTMENT,FALSE,FALSE,2,3,40,2015,41.80080242,-87.62261934
10000097,HY189976,3/18/2015 21:00,047XX W ADAMS ST,031A,ROBBERY,ARMED: HANDGUN,SIDEWALK,FALSE,FALSE,11,28,25,2015,41.87806476,-87.74335401
ERROR after logstash ran:
[2018-02-21T16:47:43,277][WARN ][logstash.outputs.elasticsearch] Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>nil, :_index=>"chicago_crime", :_type=>"doc", :_routing=>nil}, #LogStash::Event:0x4bdf395e], :response=>{"index"=>{"_index"=>"chicago_crime", "_type"=>"doc", "_id"=>"cYNWumEBzT_mw5xoIQ6O", "status"=>400, "error"=>{"type"=>"illegal_argument_exception", "reason"=>"[location] is defined as an object in mapping [doc] but this name is already used for a field in other types"}}}}
what I am missing ??