# Import csv file into elasticsearch using Logstash both version 6.2.2

**URL:** https://discuss.elastic.co/t/import-csv-file-into-elasticsearch-using-logstash-both-version-6-2-2/122226
**Category:** Logstash
**Created:** [March 2, 2018, 10:22am UTC](https://discuss.elastic.co/t/import-csv-file-into-elasticsearch-using-logstash-both-version-6-2-2/122226 "2018-03-02T10:22:41Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Karthik\_Saravanan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karthik_saravanan/32/28858_2.png) [@Karthik\_Saravanan](https://discuss.elastic.co/u/Karthik_Saravanan)
#### Post date: [March 2, 2018, 10:22am UTC](https://discuss.elastic.co/t/import-csv-file-into-elasticsearch-using-logstash-both-version-6-2-2/122226/1 "2018-03-02T10:22:41Z")

</div>

my csv file like this:  
lon,lat,number,street,unit,city,district,region,postcode,id,hash  
-149.362137,61.4558721,26101,OLD GLENN HWY,TOWER,,,,99567,,95223943e9d286f2

my conf file:  
input {   
file {  
path =\> "D:\ak-Copy.csv"  
start\_position =\> "beginning"  
}  
}  
filter {  
csv {  
separator =\> ","  
columns =\> ['lon', 'lat' ,'number','street', 'unit','city','district','region','postcode','id','hash']  
}

mutate {  
add\_field =\> { "location" =\> "geo location" }  
convert =\> {"location" =\> "geo\_point"}  
convert =\> {"number" =\> "integer"}  
convert =\> {"street" =\> "text"}  
convert =\> {"unit" =\> "text"}  
convert =\> {"city" =\> "text"}  
convert =\> {"district" =\> "text"}  
convert =\> {"region" =\> "text"}  
convert =\> {"postcode" =\> "text"}  
convert =\> {"id" =\> "text"}  
convert =\> {"hash" =\> "text"}  
rename =\> ["lon", "[location][lon]", "lat", "[location][lat]" ]  
}

}  
output {  
elasticsearch {  
hosts =\> ["localhost"]  
index =\> "geostore-ak"  
document\_type =\> "locality-test"

}  
stdout {}  
}

I'm getting error like this

```
[2018-03-02T17:15:22,233][ERROR][logstash.pipeline] Error registering plugin {:pipeline_id=>"main", :plugin=>"#<LogStash::FilterDelegator:0x501abfad @metric_events_out=org.jruby.proxy.org.logstash.instrument.metrics.counter.LongCounter$Proxy2 - name: out value:0, @metric_events_in=org.jruby.proxy.org.logstash.instrument.metrics.counter.LongCounter$Proxy2 - name: in value:0, @metric_events_time=org.jruby.proxy.org.logstash.instrument.metrics.counter.LongCounter$Proxy2 - name: duration_in_millis value:0, @id=\"2e6c343e98dfaa49dab3ef4a612cee0c2a8f6a0d208dc3b9111d270b29ffc165\", @klass=LogStash::Filters::Mutate, @metric_events=#<LogStash::Instrument::NamespacedMetric:0x4e470540 @metric=#<LogStash::Instrument::Metric:0x1501a2e1 @collector=#<LogStash::Instrument::Collector:0x794ec7a7 @agent=nil, @metric_store=#<LogStash::Instrument::MetricStore:0x7cacf8f4 @store=#<Concurrent::Map:0x00000000000fb0 entries=3 default_proc=nil>, @structured_lookup_mutex=#<Mutex:0x1dc5bc26>, @fast_lookup=#<Concurrent::Map:0x00000000000fb4 entries=66 default_proc=nil>>>>, @namespace_name=[:stats, :pipelines, :main, :plugins, :filters, :\"2e6c343e98dfaa49dab3ef4a612cee0c2a8f6a0d208dc3b9111d270b29ffc165\", :events]>, @filter=<LogStash::Filters::Mutate add_field=>{\"location\"=>\"geo location\"}, convert=>{\"location\"=>\"geo_point\", \"number\"=>\"integer\", \"street\"=>\"text\", \"unit\"=>\"text\", \"city\"=>\"text\", \"district\"=>\"text\", \"region\"=>\"text\", \"postcode\"=>\"text\", \"id\"=>\"text\", \"hash\"=>\"text\"}, rename=>{\"lon\"=>\"[location][lon]\", \"lat\"=>\"[location][lat]\"}, id=>\"2e6c343e98dfaa49dab3ef4a612cee0c2a8f6a0d208dc3b9111d270b29ffc165\", enable_metric=>true, periodic_flush=>false>>", :error=>"translation missing: en.logstash.agent.configuration.invalid_plugin_register", :thread=>"#<Thread:0x304dfd7f run>"}

```

[2018-03-02T17:15:22,270][ERROR][logstash.pipeline] Pipeline aborted due to error {:pipeline\_id=\>"main", :exception=\>#\<LogStash::ConfigurationError: translation missing: en.logstash.agent.configuration.invalid\_plugin\_register\>, :backtrace=\>["D:/www/logstash-6.2.2/vendor/bundle/jruby/2.3.0/gems/logstash-filter-mutate-3.2.0/lib/logstash/filters/mutate.rb:190:in `block in register'", "org/jruby/RubyHash.java:1343:in`each'", "D:/www/logstash-6.2.2/vendor/bundle/jruby/2.3.0/gems/logstash-filter-mutate-3.2.0/lib/logstash/filters/mutate.rb:188:in `register'", "D:/www/logstash-6.2.2/logstash-core/lib/logstash/pipeline.rb:341:in`register\_plugin'", "D:/www/logstash-6.2.2/logstash-core/lib/logstash/pipeline.rb:352:in `block in register_plugins'", "org/jruby/RubyArray.java:1734:in`each'", "D:/www/logstash-6.2.2/logstash-core/lib/logstash/pipeline.rb:352:in `register_plugins'", "D:/www/logstash-6.2.2/logstash-core/lib/logstash/pipeline.rb:736:in`maybe\_setup\_out\_plugins'", "D:/www/logstash-6.2.2/logstash-core/lib/logstash/pipeline.rb:362:in `start_workers'", "D:/www/logstash-6.2.2/logstash-core/lib/logstash/pipeline.rb:289:in`run'", "D:/www/logstash-6.2.2/logstash-core/lib/logstash/pipeline.rb:249:in `block in start'"], :thread=\>"#\<Thread:0x304dfd7f run\>"}  
[2018-03-02T17:15:22,323][ERROR][logstash.agent] Failed to execute action {:id=\>:main, :action\_type=\>LogStash::ConvergeResult::FailedAction, :message=\>"Could not execute action: LogStash::PipelineAction::Create/pipeline\_id:main, action\_result: false", :backtrace=\>nil}

is this corrects way?

---

<div class="post-metadata">

### Author: ![Johnnycc1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/johnnycc1/32/26069_2.png) [@Johnnycc1](https://discuss.elastic.co/u/Johnnycc1)
#### Post date: [March 3, 2018, 9:09pm UTC](https://discuss.elastic.co/t/import-csv-file-into-elasticsearch-using-logstash-both-version-6-2-2/122226/2 "2018-03-03T21:09:25Z")

</div>

Hey Karthik,

Your conf file looks ok (however I'm not sure the mutate is going to get the business done for the geo location - check out my example of doing exactly the same thing for the Australian Open Street Maps data [here](https://github.com/swarmee/swarmee.datasets/blob/master/openaddresses-australia/openaddresses-australia.conf).

The error message seems to be pointing to a configuration issues - if my config does not work - I would check to see if you have some invalid plugins installed.

---

<div class="post-metadata">

### Author: ![Karthik\_Saravanan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karthik_saravanan/32/28858_2.png) [@Karthik\_Saravanan](https://discuss.elastic.co/u/Karthik_Saravanan)
#### Post date: [March 6, 2018, 10:19am UTC](https://discuss.elastic.co/t/import-csv-file-into-elasticsearch-using-logstash-both-version-6-2-2/122226/3 "2018-03-06T10:19:15Z")

</div>

Thanks **Johnnycc1** , now working fine,

conf file:  
input {

```
file {
    path => "D:/ak.csv"
start_position => "beginning"
    sincedb_path => "/dev/null"
}
}
 filter {
  #lon,lat,number,street,unit,city,district,region,postcode,id,hash

   csv {
	separator => ","
	columns => [ "lon", 
      "lat","number","street","unit","city","district","region","postcode","id","hash"]
   }

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

   }
output {
	   elasticsearch {
			index => "geo-aks"
			hosts => "http://localhost:9200"		
			document_type => "locality-ak"
			template => "geo-template.json"
			template_name => "ak-template"
			template_overwrite => true
		
		}

	stdout { codec => rubydebug }
  }

```

Tempalte file:

```
           {
              "template": "ak-template",
              "settings": {
              "number_of_shards": 4,
             "number_of_replicas": 0,
             "index.codec": "best_compression",
          "index.refresh_interval" : "99s"
         },
            "mappings": {
            "address": {
             "properties": {
            "location": {
            "type": "geo_point"
              }
         }
       }
     }
  }
```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [April 3, 2018, 10:19am UTC](https://discuss.elastic.co/t/import-csv-file-into-elasticsearch-using-logstash-both-version-6-2-2/122226/4 "2018-04-03T10:19:49Z")

</div>

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