# Is it possible skip columns from csv file while uploading data into elasticsearch?

**URL:** <https://discuss.elastic.co/t/is-it-possible-skip-columns-from-csv-file-while-uploading-data-into-elasticsearch/208901>\
**Category:** Logstash\
**Created:** [November 21, 2019, 2:12pm UTC](https://discuss.elastic.co/t/is-it-possible-skip-columns-from-csv-file-while-uploading-data-into-elasticsearch/208901 "2019-11-21T14:12:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanket07](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@sanket07](https://discuss.elastic.co/u/sanket07)\
**Post date:** [November 21, 2019, 2:12pm UTC](https://discuss.elastic.co/t/is-it-possible-skip-columns-from-csv-file-while-uploading-data-into-elasticsearch/208901/1 "2019-11-21T14:12:19Z")

</div>

I have around 50 columns in csv but only 10 are useful for me. Is there any way that when I upload the data, only data for that 10 columns should be inserted in elasticsearch and only those 10 fileds should appear in kibana. Data for the remaining fields should not be uploaded.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [November 21, 2019, 2:27pm UTC](https://discuss.elastic.co/t/is-it-possible-skip-columns-from-csv-file-while-uploading-data-into-elasticsearch/208901/2 "2019-11-21T14:27:26Z")

</div>

Are you supplying the names of the columns in the columns option on the csv filter? If so, make the column names you want to delete match a pattern and then use a prune filter with a blacklist\_names option.

---

<div class="post-metadata">

**Author:** ![sanket07](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@sanket07](https://discuss.elastic.co/u/sanket07)\
**Post date:** [November 21, 2019, 2:33pm UTC](https://discuss.elastic.co/t/is-it-possible-skip-columns-from-csv-file-while-uploading-data-into-elasticsearch/208901/3 "2019-11-21T14:33:23Z")

</div>

Thanks @Badger!! will give it a try.  
One more thing can the column names in logstash can be different from that in csv?  
I am not using dynamic mapping as i have created the mapping for required fileds while creating index/

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [November 21, 2019, 3:53pm UTC](https://discuss.elastic.co/t/is-it-possible-skip-columns-from-csv-file-while-uploading-data-into-elasticsearch/208901/4 "2019-11-21T15:53:15Z")

</div>

Yes, if your csv file has a header row that contains the column names you can use that to set them, but you do not have to. You can use the columns option to set the column names to other values.

---

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [November 21, 2019, 5:53pm UTC](https://discuss.elastic.co/t/is-it-possible-skip-columns-from-csv-file-while-uploading-data-into-elasticsearch/208901/5 "2019-11-21T17:53:49Z")

</div>

something like this  
csv {  
separator =\> ","  
columns =\> ["C1","C2",C3","C4"]  
}

---

<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:** [December 20, 2019, 5:34am UTC](https://discuss.elastic.co/t/is-it-possible-skip-columns-from-csv-file-while-uploading-data-into-elasticsearch/208901/7 "2019-12-20T05:34:53Z")

</div>

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