# How to process a large csv file and add custom Python code to transform few columns to index into ElasticSearch?

**URL:** <https://discuss.elastic.co/t/how-to-process-a-large-csv-file-and-add-custom-python-code-to-transform-few-columns-to-index-into-elasticsearch/145133>\
**Category:** Logstash\
**Created:** [August 20, 2018, 10:18am UTC](https://discuss.elastic.co/t/how-to-process-a-large-csv-file-and-add-custom-python-code-to-transform-few-columns-to-index-into-elasticsearch/145133 "2018-08-20T10:18:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhishek\_Shivkumar](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@Abhishek\_Shivkumar](https://discuss.elastic.co/u/Abhishek_Shivkumar)\
**Post date:** [August 20, 2018, 10:18am UTC](https://discuss.elastic.co/t/how-to-process-a-large-csv-file-and-add-custom-python-code-to-transform-few-columns-to-index-into-elasticsearch/145133/1 "2018-08-20T10:18:22Z")

</div>

Hi,

I have a large csv file with a million rows and ~50 columns. I want to add an extra two columns and the values in these two columns is based on analysing the context on the existing few columns using some kind of text processing. Lets say, if the column 1 and column 2 contain a particular keyword in them then I insert a specific value in the extra two columns.

Is this possible in LogStash? if yes, how can we add some custom Python code that takes a decision on what the extra two columns should contain for every row?

Is there a tutorial somewhere please?

Thanks  
Abhishek S

---

<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:** [September 17, 2018, 10:18am UTC](https://discuss.elastic.co/t/how-to-process-a-large-csv-file-and-add-custom-python-code-to-transform-few-columns-to-index-into-elasticsearch/145133/2 "2018-09-17T10:18:26Z")

</div>

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