# The best way to achieve CSV imports?

**URL:** <https://discuss.elastic.co/t/the-best-way-to-achieve-csv-imports/153417>\
**Category:** Elasticsearch\
**Created:** [October 22, 2018, 2:21pm UTC](https://discuss.elastic.co/t/the-best-way-to-achieve-csv-imports/153417 "2018-10-22T14:21:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nick\_Harper](https://avatars.discourse-cdn.com/v4/letter/n/97f17d/32.png) [@Nick\_Harper](https://discuss.elastic.co/u/Nick_Harper)\
**Post date:** [October 22, 2018, 2:21pm UTC](https://discuss.elastic.co/t/the-best-way-to-achieve-csv-imports/153417/1 "2018-10-22T14:21:40Z")

</div>

Hi

I currently use Sphinx and import hundreds of product feeds into this.

I am just trying to get this working with Elastic Search but I need to figure out the best way to:

1. I have mapped the product ID to the Elastic Search ID, I assume going forward it will just update this record instead of creating a new one?
2. How do I remove old products no longer in the feeds? I was thinking to have an "updated" field which has the current time and date when it was added / updated and if older than a week then removing it with some sort of cron job?

I am using Embulk to import the CSV files I am testing at the moment using this method: [http://www.embulk.org/docs/recipe/scheduled-csv-load-to-elasticsearch-kibana5.html](http://www.embulk.org/docs/recipe/scheduled-csv-load-to-elasticsearch-kibana5.html)

Any pointers would be greay.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 23, 2018, 1:53am UTC](https://discuss.elastic.co/t/the-best-way-to-achieve-csv-imports/153417/2 "2018-10-23T01:53:45Z")

</div>

1. Yep.
2. Or have an "active" field to save you having to remove things, plus it let's you see product history.

---

<div class="post-metadata">

**Author:** ![balumurari1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/balumurari1/32/39203_2.png) [@balumurari1](https://discuss.elastic.co/u/balumurari1)\
**Post date:** [October 25, 2018, 5:52am UTC](https://discuss.elastic.co/t/the-best-way-to-achieve-csv-imports/153417/3 "2018-10-25T05:52:14Z")

</div>

We can also use logstash to import data from csv to elasticsearch. The sample example is as shown below

> [@Load csv file in logstash](https://discuss.elastic.co/t/load-csv-file-in-logstash/151319/3):
>
> Thanks for reply,hope this works fine, input { file { path =\> "D:/Balu/ELK-stack/csvfile.csv" start\_position =\> "beginning" sincedb\_path =\> "NUL" } } filter { csv { separator =\> "," columns =\> ["open","high","low","close","volume"] } } output { elasticsearch { hosts =\> "[http://localhost:9200](http://localhost:9200)" index =\> "wallet-address-index" } stdout { codec =\> rubydebug } }

---

<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:** [November 22, 2018, 5:52am UTC](https://discuss.elastic.co/t/the-best-way-to-achieve-csv-imports/153417/4 "2018-11-22T05:52:14Z")

</div>

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