# Counting of the csv file and sending the counted data to elasticsearch using logstash

**URL:** <https://discuss.elastic.co/t/counting-of-the-csv-file-and-sending-the-counted-data-to-elasticsearch-using-logstash/190760>\
**Category:** Logstash\
**Created:** [July 16, 2019, 2:39pm UTC](https://discuss.elastic.co/t/counting-of-the-csv-file-and-sending-the-counted-data-to-elasticsearch-using-logstash/190760 "2019-07-16T14:39:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![amritaraj23](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@amritaraj23](https://discuss.elastic.co/u/amritaraj23)\
**Post date:** [July 16, 2019, 2:39pm UTC](https://discuss.elastic.co/t/counting-of-the-csv-file-and-sending-the-counted-data-to-elasticsearch-using-logstash/190760/1 "2019-07-16T14:39:45Z")

</div>

Hi All,

I have a csv file with below mentioned data.  
Order,Location,Date  
123,Paris,26-07-2019  
203,Amsterdam,03-07-2019  
456,Paris,08-09-2018

I want to count and group the data on the basis of location and want to send the same to elasticsearch index. So my index should look like.  
Order\_count,Location  
2,Paris  
1,Amsterdam

and the count should increase or decrease on the basis of the data in the csv file. If the new Order is on the same location , then the count should increase and if there is a new location then the count should start from 1. How can I implement this scenario using logstash?

---

<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:** [July 16, 2019, 3:13pm UTC](https://discuss.elastic.co/t/counting-of-the-csv-file-and-sending-the-counted-data-to-elasticsearch-using-logstash/190760/2 "2019-07-16T15:13:08Z")

</div>

Take a look at [example 5](https://www.elastic.co/guide/en/logstash/current/plugins-filters-aggregate.html#plugins-filters-aggregate-example5) for the aggregate filter.

---

<div class="post-metadata">

**Author:** ![amritaraj23](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@amritaraj23](https://discuss.elastic.co/u/amritaraj23)\
**Post date:** [July 17, 2019, 9:20am UTC](https://discuss.elastic.co/t/counting-of-the-csv-file-and-sending-the-counted-data-to-elasticsearch-using-logstash/190760/3 "2019-07-17T09:20:40Z")

</div>

Hi,

There is no counting of data in this example.  
Can you help me with some other example.

---

<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:** [July 17, 2019, 1:02pm UTC](https://discuss.elastic.co/t/counting-of-the-csv-file-and-sending-the-counted-data-to-elasticsearch-using-logstash/190760/4 "2019-07-17T13:02:19Z")

</div>

> [@amritaraj23](#):
>
> There is no counting of data in this example.

Counting of events is exactly what example 5 does.

---

<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:** [August 14, 2019, 1:02pm UTC](https://discuss.elastic.co/t/counting-of-the-csv-file-and-sending-the-counted-data-to-elasticsearch-using-logstash/190760/5 "2019-08-14T13:02:29Z")

</div>

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