# How do I increment my count field of my document from logstash?

**URL:** <https://discuss.elastic.co/t/how-do-i-increment-my-count-field-of-my-document-from-logstash/27993>\
**Category:** Elasticsearch\
**Created:** [August 25, 2015, 7:43am UTC](https://discuss.elastic.co/t/how-do-i-increment-my-count-field-of-my-document-from-logstash/27993 "2015-08-25T07:43:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![N\_M\_10](https://avatars.discourse-cdn.com/v4/letter/n/f19dbf/32.png) [@N\_M\_10](https://discuss.elastic.co/u/N_M_10)\
**Post date:** [August 25, 2015, 7:43am UTC](https://discuss.elastic.co/t/how-do-i-increment-my-count-field-of-my-document-from-logstash/27993/1 "2015-08-25T07:43:20Z")

</div>

I want to update one field of my document/log in elasticsearch from logstash.

My logstash conf file

```
input { 
	http {
    host => "127.0.0.1" # default: 0.0.0.0
    port => 31311 # default: 8080
  }
}

output { 
  stdout { codec => json },
  elasticsearch {
  		action => "update"
  		bind_host => "127.0.0.1"
  		bind_port => 9200
  		document_id => "ET00009682"
  		index => "in12"
  		type => "event"
  }
}

```

I want to increment my count field by one how do I specify that in my output of logstash.

Note: I know to update i need to use this script

```
"script" : "ctx._source.count += 1"

```

but I am not sure where to place it in output of logstash?

Kindly help  
thanks

---

<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:** [July 5, 2017, 11:54pm UTC](https://discuss.elastic.co/t/how-do-i-increment-my-count-field-of-my-document-from-logstash/27993/2 "2017-07-05T23:54:04Z")

</div>


