模板映射不起作用

时间:2018-05-09 10:20:33

标签: elasticsearch logstash kibana

我正在尝试将纬度和经度转换为geo_point位置,以便在地图可视化中使用它。

这是我的配置:

 input{

    file{
        path=>"C:\Users\Ahmed\Desktop\311_Service_Requests_from_2015.csv"
        start_position=>"beginning"
        sincedb_path=>NUL
        }
     }

filter{

  csv{
      separator=>","
      columns=>["Unique Key","Created Date","Closed Date","Agency","Agency Name","Complaint Type","Descriptor","Location Type","Incident Zip","Incident Address","Street Name","Cross Street 1","Cross Street 2","Intersection Street 1","Intersection Street 2","Address Type","City","Landmark","Facility Type","Status","Due Date"," Resolution Description","Resolution Action Updated Date","Community Board","Borough","X Coordinate (State Plane)","Y Coordinate (State Plane)","Park Facility Name","Park Borough","School Name","School Number","School Region","School Code","School Phone Number",   "School Address","School City","School State","School Zip","School Not Found","School or Citywide Complaint","Vehicle Type","Taxi Company Borough","Taxi Pick Up Location","Bridge Highway Name","Bridge Highway Direction","Road Ramp","Bridge Highway Segment","Garage Lot Name","Ferry Direction","Ferry Terminal Name","Latitude","Longitude","Location"]

     }
 mutate{
     convert=>["Latitude","float"]
 convert=>["Longitude","float"] 
 rename=>["Latitude","[location][lat]"] 
 rename=>["Longitude","[location][lon]"]
 }              

 date{ 
    match=>["Created Date","MM/dd/yyyy HH:mm:ss aa"]
    target=>"Date"  
    }
 }

  output{   

  elasticsearch {
     hosts=> "localhost"
     index=> "nyc311calls7"
    document_type=>"calls"
   }        
  stdout{codec=>rubydebug}
}

我在youtube中看到我需要在创建索引模式之前添加此模板:

put _template/nyc*311*7
{
"order":0,
 "index_patterns":"nyc*311*7",
 "mapping":{
   "_default":{
    "properties":{
    "location ":{
     "type":"geo_point"
     }
   }
  }
 }
}

如果您重新输入我的代码并与您合作,请告诉我

1 个答案:

答案 0 :(得分:2)

我在discuss.elastic site中找到了解决方案。

PUT _template/nyc 
{
  "order":0,
  "index_patterns":"nyc",
   "mappings":{
   "_default_":{
      "properties":{
        "location":{
          "type":"geo_point"
          }
       }
     }
   }
 }
相关问题