# Auto generated id

**URL:** <https://discuss.elastic.co/t/auto-generated-id/11475>\
**Category:** Elasticsearch\
**Created:** [April 6, 2013, 6:20pm UTC](https://discuss.elastic.co/t/auto-generated-id/11475 "2013-04-06T18:20:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![okamalo](https://avatars.discourse-cdn.com/v4/letter/o/eb9ed0/32.png) [@okamalo](https://discuss.elastic.co/u/okamalo)\
**Post date:** [April 6, 2013, 6:20pm UTC](https://discuss.elastic.co/t/auto-generated-id/11475/1 "2013-04-06T18:20:04Z")

</div>

This is my first exploration for ES, I understand the id is auto generated  
if I did not user one,however here is what I get :

curl -XPUT [http://localhost:9200/indextest/dns](http://localhost:9200/indextest/dns) -d ' {  
"url": "[www.cnn.com](http://www.cnn.com)", "domain": "[cnn.com](http://cnn.com)" }'

No handler found for uri [/indextest/dns] and method [PUT]

however it works well when I use the id manually :

curl -XPUT [http://localhost:9200/indextest/dns/1](http://localhost:9200/indextest/dns/1) -d ' {  
"url": "[www.cnn.com](http://www.cnn.com)", "domain": "[cnn.com](http://cnn.com)" }'

{"ok":true,"\_index":"indextest","\_type":"dns","\_id":"1","\_version":1}

Am I missing something here?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![simonw\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simonw_2/32/1130_2.png) [@simonw\_2](https://discuss.elastic.co/u/simonw_2)\
**Post date:** [April 6, 2013, 7:16pm UTC](https://discuss.elastic.co/t/auto-generated-id/11475/2 "2013-04-06T19:16:07Z")

</div>

see the reference guide:

The index operation can be executed without specifying the id. In such a  
case, an id will be generated automatically. In addition, the op\_type will  
automatically be set to create. Here is an example (note the _POST_ used  
instead of _PUT_):

$ curl -XPOST '[http://localhost:9200/twitter/tweet/](http://localhost:9200/twitter/tweet/)' -d '{  
"user" : "kimchy",  
"post\_date" : "2009-11-15T14:12:12",  
"message" : "trying out Elastic Search"  
}'

On Saturday, April 6, 2013 8:20:04 PM UTC+2, [os...@okamalo.com](mailto:os...@okamalo.com) wrote:

> This is my first exploration for ES, I understand the id is auto generated  
> if I did not user one,however here is what I get :
> 
> curl -XPUT [http://localhost:9200/indextest/dns](http://localhost:9200/indextest/dns) -d ' {  
> "url": "[www.cnn.com](http://www.cnn.com)", "domain": "[cnn.com](http://cnn.com)" }'
> 
> No handler found for uri [/indextest/dns] and method [PUT]
> 
> however it works well when I use the id manually :
> 
> curl -XPUT [http://localhost:9200/indextest/dns/1](http://localhost:9200/indextest/dns/1) -d ' {  
> "url": "[www.cnn.com](http://www.cnn.com)", "domain": "[cnn.com](http://cnn.com)" }'
> 
> {"ok":true,"\_index":"indextest","\_type":"dns","\_id":"1","\_version":1}
> 
> Am I missing something here?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![okamalo](https://avatars.discourse-cdn.com/v4/letter/o/eb9ed0/32.png) [@okamalo](https://discuss.elastic.co/u/okamalo)\
**Post date:** [April 7, 2013, 6:46pm UTC](https://discuss.elastic.co/t/auto-generated-id/11475/3 "2013-04-07T18:46:48Z")

</div>

Thank you.

On Saturday, April 6, 2013 10:16:07 PM UTC+3, simonw wrote:

> see the reference guide:
> 
> The index operation can be executed without specifying the id. In such a  
> case, an id will be generated automatically. In addition, the op\_type will  
> automatically be set to create. Here is an example (note the _POST_ used  
> instead of _PUT_):
> 
> $ curl -XPOST '[http://localhost:9200/twitter/tweet/](http://localhost:9200/twitter/tweet/)' -d '{  
> "user" : "kimchy",  
> "post\_date" : "2009-11-15T14:12:12",  
> "message" : "trying out Elastic Search"  
> }'
> 
> On Saturday, April 6, 2013 8:20:04 PM UTC+2, [os...@okamalo.com](mailto:os...@okamalo.com) wrote:
> 
> > This is my first exploration for ES, I understand the id is auto  
> > generated if I did not user one,however here is what I get :
> > 
> > curl -XPUT [http://localhost:9200/indextest/dns](http://localhost:9200/indextest/dns) -d ' {  
> > "url": "[www.cnn.com](http://www.cnn.com)", "domain": "[cnn.com](http://cnn.com)" }'
> > 
> > No handler found for uri [/indextest/dns] and method [PUT]
> > 
> > however it works well when I use the id manually :
> > 
> > curl -XPUT [http://localhost:9200/indextest/dns/1](http://localhost:9200/indextest/dns/1) -d ' {  
> > "url": "[www.cnn.com](http://www.cnn.com)", "domain": "[cnn.com](http://cnn.com)" }'
> > 
> > {"ok":true,"\_index":"indextest","\_type":"dns","\_id":"1","\_version":1}
> > 
> > Am I missing something here?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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 6, 2017, 2:42am UTC](https://discuss.elastic.co/t/auto-generated-id/11475/4 "2017-07-06T02:42:21Z")

</div>


