# CouchDB plugin set dynamic type for Elasticsearch

**URL:** <https://discuss.elastic.co/t/couchdb-plugin-set-dynamic-type-for-elasticsearch/2293>\
**Category:** Logstash\
**Created:** [June 10, 2015, 10:47am UTC](https://discuss.elastic.co/t/couchdb-plugin-set-dynamic-type-for-elasticsearch/2293 "2015-06-10T10:47:04Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [June 10, 2015, 4:56pm UTC](https://discuss.elastic.co/t/couchdb-plugin-set-dynamic-type-for-elasticsearch/2293/2 "2015-06-10T16:56:10Z")

</div>

This configuration:

```
type => "%{type}"

```

...will not work in an input block.

If field type is in with \_id and \_rev, that field is, quite likely, in the @metadata field as [@metadata][type]. If so, you'd need to overwrite the Logstash event's type with a mutate replace:

```
mutate {
  replace => { "type" => "%{[@metadata][type]}" }
}
```

---

_[View the full topic](https://discuss.elastic.co/t/couchdb-plugin-set-dynamic-type-for-elasticsearch/2293)._
