# CouchDB River Plugin Indices

**URL:** <https://discuss.elastic.co/t/couchdb-river-plugin-indices/19977>\
**Category:** Elasticsearch\
**Created:** [September 26, 2014, 9:22am UTC](https://discuss.elastic.co/t/couchdb-river-plugin-indices/19977 "2014-09-26T09:22:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Godo](https://avatars.discourse-cdn.com/v4/letter/g/ee59a6/32.png) [@Godo](https://discuss.elastic.co/u/Godo)\
**Post date:** [September 26, 2014, 9:22am UTC](https://discuss.elastic.co/t/couchdb-river-plugin-indices/19977/1 "2014-09-26T09:22:07Z")

</div>

Hi,

I've read the forum to solve my problem, but unfortunately I couldn't handle it or I can't see it from where I am now.

So I have a CouchDB database with multiple types of documents("doc.type"), for which I want to create my\_field ElasticSearch River indices, containing complex queries. This field is not (phisically stored) in my documents, but I want it to return **0** when **doc.fieldName ==""** or to return **int(substr(doc.fieldName, 5)))** when **doc.fieldName != ""** , and then query after my\_fields.

My questions are:

1. How can I make this happen?
2. Should I use ElasticSearch mapping / scripts, CouchDB filters or...(other solution that you can think)?

Please provide an example if possible, so I can fully understand how to implement the answer in my project.

Thanks in advance,

Bogdan Godociu

---

<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, 12:59am UTC](https://discuss.elastic.co/t/couchdb-river-plugin-indices/19977/2 "2017-07-06T00:59:44Z")

</div>


