# How to create index automatically by logstash conf

**URL:** <https://discuss.elastic.co/t/how-to-create-index-automatically-by-logstash-conf/27468>\
**Category:** Logstash\
**Created:** [August 17, 2015, 3:12am UTC](https://discuss.elastic.co/t/how-to-create-index-automatically-by-logstash-conf/27468 "2015-08-17T03:12:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jason\_Zheng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jason_zheng/32/4041_2.png) [@Jason\_Zheng](https://discuss.elastic.co/u/Jason_Zheng)\
**Post date:** [August 17, 2015, 3:12am UTC](https://discuss.elastic.co/t/how-to-create-index-automatically-by-logstash-conf/27468/1 "2015-08-17T03:12:58Z")

</div>

Hi all,

when I call

```
$curl -XPUT -u es_admin:iiiiii 'http://localhost:9200/franky/json/1' -d '{ "ismb.miki.host":"192.168.10.53" }'

```

the result is

```
{"_index":"franky","_type":"json","_id":"1","_version":2,"created":false}

```

why attribute 'created' is false?

I would like to create index franky from logstash conf file automatically, did I missing something?

```
            elasticsearch {
                    cluster => "elasticsearch"
                    host => "elasticsearch"
                    codec => "json"
                    protocol => "http"
                    index => "franky"
            }
```

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 17, 2015, 3:30am UTC](https://discuss.elastic.co/t/how-to-create-index-automatically-by-logstash-conf/27468/2 "2015-08-17T03:30:54Z")

</div>

Because you are updating an existing document.

That config looks mostly ok, you can remove the `cluster` part, and are you sure the hostname is 'elasticsearch`?  
Otherwise, does it not work?

---

<div class="post-metadata">

**Author:** ![Jason\_Zheng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jason_zheng/32/4041_2.png) [@Jason\_Zheng](https://discuss.elastic.co/u/Jason_Zheng)\
**Post date:** [August 17, 2015, 3:38am UTC](https://discuss.elastic.co/t/how-to-create-index-automatically-by-logstash-conf/27468/3 "2015-08-17T03:38:21Z")

</div>

Hi Mark,

Thanks for replying,

It works, but attribute 'created' of index 'franky' is false, and attribute 'created' of default index 'logstash' is true?

```
{"_index":"logstash","_type":"json","_id":"1","_version":1,"created":true}
```

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 17, 2015, 3:56am UTC](https://discuss.elastic.co/t/how-to-create-index-automatically-by-logstash-conf/27468/4 "2015-08-17T03:56:41Z")

</div>

I think you might be conflating the two things here.

Are you getting that from the LS log?

---

<div class="post-metadata">

**Author:** ![Jason\_Zheng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jason_zheng/32/4041_2.png) [@Jason\_Zheng](https://discuss.elastic.co/u/Jason_Zheng)\
**Post date:** [August 17, 2015, 4:17am UTC](https://discuss.elastic.co/t/how-to-create-index-automatically-by-logstash-conf/27468/5 "2015-08-17T04:17:27Z")

</div>

Hi Mark,

Yes, that is from the LS log, I am confusing with 'created', when 'created' be true/false?

Thanks

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 17, 2015, 5:18am UTC](https://discuss.elastic.co/t/how-to-create-index-automatically-by-logstash-conf/27468/6 "2015-08-17T05:18:04Z")

</div>

You have two questions here.

1. When you use that curl and get that response (note: `"_version":2`) that means you have updated a document that already existed, this is why you also got `"created":false`.
2. Your Logstash config looks ok, per my previous comments. If you want to check that the index exists then use `curl localhost:9200/_cat/indices` and you should see it.

---

<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, 5:31am UTC](https://discuss.elastic.co/t/how-to-create-index-automatically-by-logstash-conf/27468/7 "2017-07-06T05:31:50Z")

</div>


