# Logstash, how to define unique id for tweets?

**URL:** <https://discuss.elastic.co/t/logstash-how-to-define-unique-id-for-tweets/96159>\
**Category:** Logstash\
**Created:** [August 7, 2017, 9:50pm UTC](https://discuss.elastic.co/t/logstash-how-to-define-unique-id-for-tweets/96159 "2017-08-07T21:50:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lbr1](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@Lbr1](https://discuss.elastic.co/u/Lbr1)\
**Post date:** [August 7, 2017, 9:50pm UTC](https://discuss.elastic.co/t/logstash-how-to-define-unique-id-for-tweets/96159/1 "2017-08-07T21:50:20Z")

</div>

Good evening, I have the following output in my logstash file

```
output {
	stdout { codec => dots }
	#stdout { codec => rubydebug }
	#stdout { codec => json }
	elasticsearch {
		hosts => "localhost:9200"
		index => "game"
		document_type => "tweet"
		template => "twitter_template.json"
		template_name => "twitter"
  }

```

I can get the tweets, and I'm using the rest client in java to access information. But how do I define the ids of each tweet?

I try to access it through the browser:

`Http: // localhost: 9200 / game / tweet / id?`

Is there any way I can define ids incrementally? Or how do I access a twitter through the browser?

ty

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [August 8, 2017, 11:18am UTC](https://discuss.elastic.co/t/logstash-how-to-define-unique-id-for-tweets/96159/2 "2017-08-08T11:18:17Z")

</div>

As configured, ES will assign a document id automatically as each event is indexed. If you don't want that you can pick your own id, but it's not clear why you'd want to do that.

---

<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 5, 2017, 11:18am UTC](https://discuss.elastic.co/t/logstash-how-to-define-unique-id-for-tweets/96159/3 "2017-09-05T11:18:23Z")

</div>

Closed on September 5, 2017, 11:18am UTC

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