# Index not creating from couchdb with logstash

**URL:** <https://discuss.elastic.co/t/index-not-creating-from-couchdb-with-logstash/27848>\
**Category:** Logstash\
**Created:** [August 21, 2015, 4:23pm UTC](https://discuss.elastic.co/t/index-not-creating-from-couchdb-with-logstash/27848 "2015-08-21T16:23:35Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![imad](https://avatars.discourse-cdn.com/v4/letter/i/f08c70/32.png) [@imad](https://discuss.elastic.co/u/imad)\
**Post date:** [August 21, 2015, 4:23pm UTC](https://discuss.elastic.co/t/index-not-creating-from-couchdb-with-logstash/27848/1 "2015-08-21T16:23:35Z")

</div>

```
      I am using this config file to import data from couchdb. 

```

input {

```
couchdb_changes {

    db => "roles"

    host => "localhost"

    port => 5984

}

```

}

output {

elasticsearch {

```
    document_id => "%{[@metadata][_id]}"

    document_type => "%{[@metadata][type]}"

    host => "localhost"

    index => "roles_index"

    protocol => "http"

    host => localhost

    port => 9200

```

}

}

I was able to run logstash with this config file and import data  
once. I closed command prompt to shutdown logstash and reran cmd prompt  
and stash with the config file again. but now I cannot see any index  
created. Is there anything that I might be doing wrong here. I am using  
ctl+c to kill logstash in cmd prompt. Will appreciate any help.

Thanks.

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [August 21, 2015, 5:30pm UTC](https://discuss.elastic.co/t/index-not-creating-from-couchdb-with-logstash/27848/2 "2015-08-21T17:30:07Z")

</div>

If you ran it once, is it possible that the sequence is stored in [`sequence_path`](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-couchdb_changes.html#plugins-inputs-couchdb_changes-sequence_path) so it thinks it's already indexed everything.

If you delete this file, or edit it to 0, it should start over from the beginning and re-index all of your couchdb content.

---

<div class="post-metadata">

**Author:** ![imad](https://avatars.discourse-cdn.com/v4/letter/i/f08c70/32.png) [@imad](https://discuss.elastic.co/u/imad)\
**Post date:** [August 21, 2015, 6:56pm UTC](https://discuss.elastic.co/t/index-not-creating-from-couchdb-with-logstash/27848/3 "2015-08-21T18:56:05Z")

</div>

if you don't mind.. which file is that that I need to delete or set sequence\_path to 0.

---

<div class="post-metadata">

**Author:** ![imad](https://avatars.discourse-cdn.com/v4/letter/i/f08c70/32.png) [@imad](https://discuss.elastic.co/u/imad)\
**Post date:** [August 21, 2015, 7:02pm UTC](https://discuss.elastic.co/t/index-not-creating-from-couchdb-with-logstash/27848/4 "2015-08-21T19:02:07Z")

</div>

Got it I set sequence\_path =\> "0" in couchdb\_changes { } section of my config file and it worked.

Thanks for your response.

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [August 21, 2015, 7:29pm UTC](https://discuss.elastic.co/t/index-not-creating-from-couchdb-with-logstash/27848/5 "2015-08-21T19:29:27Z")

</div>

Oh! I'm sorry I didn't make myself more clear. The file identified by `sequence_path` should _contain_ a zero. You just named a file `0` in your home directory which is storing the current sequence number. The link I shared previously shares the default file name and path. This worked, but if you delete a file named `0` in your home directory because you don't know what it does, it will potentially cause issues for you.

---

<div class="post-metadata">

**Author:** ![imad](https://avatars.discourse-cdn.com/v4/letter/i/f08c70/32.png) [@imad](https://discuss.elastic.co/u/imad)\
**Post date:** [August 21, 2015, 8:33pm UTC](https://discuss.elastic.co/t/index-not-creating-from-couchdb-with-logstash/27848/6 "2015-08-21T20:33:08Z")

</div>

I am still having the problem. Sorry for not understanding it correctly. You were right a file named "0" got generated in my logstash-1.5.2\bin folder. I deleted that but still didn't make it to run. As per the link that you sent for sequence\_path .couchdb\_seq in bin folder is the file where were sequence numbers are kept. I though didn't see .couchdb\_seq in my bin folder, I created it my self and put a 0 in it, then ran Logstash again with my config file but still cannot create any indices.

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [August 21, 2015, 9:01pm UTC](https://discuss.elastic.co/t/index-not-creating-from-couchdb-with-logstash/27848/7 "2015-08-21T21:01:10Z")

</div>

The `0` file and the default placement of the `.couchdb_seq` file would not necessarily be in the same place (it ran once correctly, so that file is _somewhere_, even if it's not in the `bin` directory.

I would specify a full-path to the file, putting it somewhere you will know where it is, and that the Logstash process will have write permissions.

---

<div class="post-metadata">

**Author:** ![imad](https://avatars.discourse-cdn.com/v4/letter/i/f08c70/32.png) [@imad](https://discuss.elastic.co/u/imad)\
**Post date:** [August 21, 2015, 9:32pm UTC](https://discuss.elastic.co/t/index-not-creating-from-couchdb-with-logstash/27848/8 "2015-08-21T21:32:18Z")

</div>

Got it. So I created "couchdb\_seq" file and set it to sequence\_path. It works now if I reset value in file couchdb\_seq to 0 every time I want to run logstash to import data in elasticsearch index. Is there any other way for this.

I want to now have multiple inputs/outpust based on condition in my config file to create more than one indices. But with the approach to set sequence\_path to "couchdb\_seq". My indices are not getting created. So are there any other ways to resolve this?

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [August 21, 2015, 9:47pm UTC](https://discuss.elastic.co/t/index-not-creating-from-couchdb-with-logstash/27848/9 "2015-08-21T21:47:33Z")

</div>

The idea of the couchdb\_changes feed is that you should only have to import once, and then any changes that come through would be propagated (hence, the \_changes feed).

Are you trying to re-run the import multiple times to populate multiple indices?

You can accomplish this with conditionals and multiple elasticsearch output blocks, or with the sprintf format and the index name attribute.

If you need multiple inputs (or have multiple couchdb databases), you can define one couchdb\_changes input block per database. Be sure to use a different sequence\_path with each db, to keep them from colliding.

Use tags to identify different streams. This will make it easier to control which feeds go to which indices.

---

<div class="post-metadata">

**Author:** ![imad](https://avatars.discourse-cdn.com/v4/letter/i/f08c70/32.png) [@imad](https://discuss.elastic.co/u/imad)\
**Post date:** [August 24, 2015, 4:58am UTC](https://discuss.elastic.co/t/index-not-creating-from-couchdb-with-logstash/27848/10 "2015-08-24T04:58:06Z")

</div>

Yes I wanted to import data from multiple databases into separate indices. Thank Aaron for helping me out. It worked, I can create indices for each database now. Here is my config file for anyone who is also looking to do the same.

input {  
couchdb\_changes {  
db =\> "users"  
host =\> "localhost"  
port =\> 5984  
sequence\_path =\> "users\_couchdb\_seq"  
tags =\> ["users"]  
}  
couchdb\_changes {  
db =\> "roles"  
host =\> "localhost"  
port =\> 5984  
sequence\_path =\> "roles\_couchdb\_seq"  
tags =\> ["roles"]  
}  
}  
output {  
if "users" in [tags] {  
elasticsearch {  
document\_id =\> "%{[@metadata][\_id]}"  
host =\> "127.0.0.1"  
index =\> "users\_index"  
protocol =\> "http"  
host =\> '127.0.0.1'  
port =\> 9200  
}  
}  
if "roles" in [tags] {  
elasticsearch {  
document\_id =\> "%{[@metadata][\_id]}"  
host =\> "127.0.0.1"  
index =\> "roles\_index"  
protocol =\> "http"  
host =\> '127.0.0.1'  
port =\> 9200  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![imad](https://avatars.discourse-cdn.com/v4/letter/i/f08c70/32.png) [@imad](https://discuss.elastic.co/u/imad)\
**Post date:** [September 25, 2015, 6:34pm UTC](https://discuss.elastic.co/t/index-not-creating-from-couchdb-with-logstash/27848/11 "2015-09-25T18:34:30Z")

</div>

@theuntergeek is there anyother way to recreate index if they are already created without using sequence\_path method?

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [September 25, 2015, 7:26pm UTC](https://discuss.elastic.co/t/index-not-creating-from-couchdb-with-logstash/27848/12 "2015-09-25T19:26:54Z")

</div>

You could duplicate the input and have a separate sequence\_path. That's about it.

---

<div class="post-metadata">

**Author:** ![imad](https://avatars.discourse-cdn.com/v4/letter/i/f08c70/32.png) [@imad](https://discuss.elastic.co/u/imad)\
**Post date:** [September 25, 2015, 7:29pm UTC](https://discuss.elastic.co/t/index-not-creating-from-couchdb-with-logstash/27848/13 "2015-09-25T19:29:19Z")

</div>

Ok, if logstash can have a flag to flush and recreate indices, it would be very handy.

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [September 25, 2015, 7:54pm UTC](https://discuss.elastic.co/t/index-not-creating-from-couchdb-with-logstash/27848/14 "2015-09-25T19:54:33Z")

</div>

Logstash will not likely ever have this feature. If you want to recreate an index, you really ought to use the sequence\_path method. It's by far the fastest and simplest way to achieve your goal. You can drop indices with simple API calls (delete) or use [Elasticsearch Curator](https://www.elastic.co/guide/en/elasticsearch/client/curator/current/index.html).

You'd still have to rebuild the pipeline in future releases of Logstash, as the input plugin would still need to restart with the appropriate sequence number. Once the pipeline is established, it will not re-read the sequence id unless there's an error or a disconnect.

---

<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:27am UTC](https://discuss.elastic.co/t/index-not-creating-from-couchdb-with-logstash/27848/15 "2017-07-06T05:27:58Z")

</div>


