# ElasticSearch + CouchDB + BIG\_INTEGER = Oh My

**URL:** <https://discuss.elastic.co/t/elasticsearch-couchdb-big-integer-oh-my/11815>\
**Category:** Elasticsearch\
**Created:** [May 5, 2013, 2:09am UTC](https://discuss.elastic.co/t/elasticsearch-couchdb-big-integer-oh-my/11815 "2013-05-05T02:09:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chewxy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chewxy/32/2341_2.png) [@Chewxy](https://discuss.elastic.co/u/Chewxy)\
**Post date:** [May 5, 2013, 2:09am UTC](https://discuss.elastic.co/t/elasticsearch-couchdb-big-integer-oh-my/11815/1 "2013-05-05T02:09:07Z")

</div>

Hello,  
I seem to be running into some trouble with Elasticsearch and the CouchDB  
River plugin.

When elasticsearch indexes my database \_changes, it runs into this problem:

Exception in thread "elasticsearch[Trapper][couchdb\_river\_indexer][T#1]"

> org.elasticsearch.ElasticSearchIllegalStateException: No matching token for  
> number\_type [BIG\_INTEGER]  
> at  
> org.elasticsearch.common.xcontent.json.JsonXContentParser.convertNumberType(JsonXContentParser.java:206)  
> at  
> org.elasticsearch.common.xcontent.json.JsonXContentParser.numberType(JsonXContentParser.java:65)  
> at  
> org.elasticsearch.common.xcontent.support.XContentMapConverter.readValue(XContentMapConverter.java:97)  
> at  
> org.elasticsearch.common.xcontent.support.XContentMapConverter.readMap(XContentMapConverter.java:77)  
> at  
> org.elasticsearch.common.xcontent.support.XContentMapConverter.readValue(XContentMapConverter.java:110)  
> at  
> org.elasticsearch.common.xcontent.support.XContentMapConverter.readMap(XContentMapConverter.java:77)  
> at  
> org.elasticsearch.common.xcontent.support.XContentMapConverter.readMap(XContentMapConverter.java:56)  
> at  
> org.elasticsearch.common.xcontent.support.AbstractXContentParser.map(AbstractXContentParser.java:121)  
> at  
> org.elasticsearch.common.xcontent.support.AbstractXContentParser.mapAndClose(AbstractXContentParser.java:132)  
> at  
> org.elasticsearch.river.couchdb.CouchdbRiver.processLine(CouchdbRiver.java:218)  
> at  
> org.elasticsearch.river.couchdb.CouchdbRiver.access$500(CouchdbRiver.java:64)  
> at  
> org.elasticsearch.river.couchdb.CouchdbRiver$Indexer.run(CouchdbRiver.java:334)  
> at java.lang.Thread.run(Thread.java:679)

This is because I have a number of documents in my database with field  
values that look like 4634970607942323000.

I have googled around, and tried filtering, but filtering seems to only  
lead to filtering of document types (or documents with certain fields and  
values). I don't seem to be able to filter out fields from being indexed.

These are my solutions so far, with notes in parens:

- rewrite all field values in couchdb with BIG\_INTEGER to smaller values  
(problem: I tried doing that, and still ran into the same problem, albeit  
now I have more documents indexed. I suspect the issue is with unknown  
fields with large integers. I have no idea where Elasticsearch stopped  
indexing and even logging level set to TRACE yielded no clues)
- cast all field values from \_changes to strings (only a few fields  
matter in my documents, and those that have integers in them are meta data  
usually. I tried with custom mapping and got terribly muddled)
- make couchdb-river ignore certain fields when indexing documents (I  
have no idea how to do that. I read the filtering documentation, and  
managed to filter only documents with certain fields and certain values for  
the fields, but that's not what I want)
- make couchdb-river ignore fields when error occurs. (I have no idea  
how to do this either)

So, Elasticsearch community, help me, you're my only hope 😛

--  
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:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 5, 2013, 8:06am UTC](https://discuss.elastic.co/t/elasticsearch-couchdb-big-integer-oh-my/11815/2 "2013-05-05T08:06:42Z")

</div>

May be script filters could help here:

> **[GitHub - elastic/elasticsearch-river-couchdb: CouchDB River Plugin for...](https://github.com/elastic/elasticsearch-river-couchdb#script-filters)**
>
> CouchDB River Plugin for elasticsearch (STOPPED). Contribute to elastic/elasticsearch-river-couchdb development by creating an account on GitHub.

{ "type" : "couchdb", "couchdb" : { "script" : "ctx.doc.field1 = ctx.doc.field1\>1000000? 0: ctx.doc.field1" } }  
Or something like that...  
HTH

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 5 mai 2013 à 04:09, Chewxy [chewxy@gmail.com](mailto:chewxy@gmail.com) a écrit :

Hello,  
I seem to be running into some trouble with Elasticsearch and the CouchDB River plugin.

When elasticsearch indexes my database \_changes, it runs into this problem:

> Exception in thread "elasticsearch[Trapper][couchdb\_river\_indexer][T#1]" org.elasticsearch.ElasticSearchIllegalStateException: No matching token for number\_type [BIG\_INTEGER]  
> at org.elasticsearch.common.xcontent.json.JsonXContentParser.convertNumberType(JsonXContentParser.java:206)  
> at org.elasticsearch.common.xcontent.json.JsonXContentParser.numberType(JsonXContentParser.java:65)  
> at org.elasticsearch.common.xcontent.support.XContentMapConverter.readValue(XContentMapConverter.java:97)  
> at org.elasticsearch.common.xcontent.support.XContentMapConverter.readMap(XContentMapConverter.java:77)  
> at org.elasticsearch.common.xcontent.support.XContentMapConverter.readValue(XContentMapConverter.java:110)  
> at org.elasticsearch.common.xcontent.support.XContentMapConverter.readMap(XContentMapConverter.java:77)  
> at org.elasticsearch.common.xcontent.support.XContentMapConverter.readMap(XContentMapConverter.java:56)  
> at org.elasticsearch.common.xcontent.support.AbstractXContentParser.map(AbstractXContentParser.java:121)  
> at org.elasticsearch.common.xcontent.support.AbstractXContentParser.mapAndClose(AbstractXContentParser.java:132)  
> at org.elasticsearch.river.couchdb.CouchdbRiver.processLine(CouchdbRiver.java:218)  
> at org.elasticsearch.river.couchdb.CouchdbRiver.access$500(CouchdbRiver.java:64)  
> at org.elasticsearch.river.couchdb.CouchdbRiver$Indexer.run(CouchdbRiver.java:334)  
> at java.lang.Thread.run(Thread.java:679)

This is because I have a number of documents in my database with field values that look like 4634970607942323000.

I have googled around, and tried filtering, but filtering seems to only lead to filtering of document types (or documents with certain fields and values). I don't seem to be able to filter out fields from being indexed.

These are my solutions so far, with notes in parens:

rewrite all field values in couchdb with BIG\_INTEGER to smaller values (problem: I tried doing that, and still ran into the same problem, albeit now I have more documents indexed. I suspect the issue is with unknown fields with large integers. I have no idea where Elasticsearch stopped indexing and even logging level set to TRACE yielded no clues)  
cast all field values from \_changes to strings (only a few fields matter in my documents, and those that have integers in them are meta data usually. I tried with custom mapping and got terribly muddled)  
make couchdb-river ignore certain fields when indexing documents (I have no idea how to do that. I read the filtering documentation, and managed to filter only documents with certain fields and certain values for the fields, but that's not what I want)  
make couchdb-river ignore fields when error occurs. (I have no idea how to do this either)  
So, Elasticsearch community, help me, you're my only hope 😛

--  
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).

--  
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:** ![Chewxy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chewxy/32/2341_2.png) [@Chewxy](https://discuss.elastic.co/u/Chewxy)\
**Post date:** [May 14, 2013, 2:01pm UTC](https://discuss.elastic.co/t/elasticsearch-couchdb-big-integer-oh-my/11815/3 "2013-05-14T14:01:27Z")

</div>

Sorry for replying late, and being a little obtuse about this:

I ran it with a script. The script does this in order:

- ctx.ignore = ctx.doc.type = \u0027User\0027. Basically this forces  
elasticsearch to ignore the doc\_type called 'User', since I only want  
elasticsearch to index documents with doc\_type = 'stream'.
- I then changed all the public fields of documents with doc\_type stream  
to 0, just to test and see what gets indexed by elasticsearch.

I still get the same BIG\_INTEGER error. I noticed that the \_id field for  
documents with doc\_type = 'stream' looks something like  
this: fe17f8e4dec24572bf99d7310d7338ed. Could this has somehow be  
interpreted as a base16 number and cast into an integer by elasticsearch?

Also, is it possible to get elasticsearch to show where which document ID  
caused the error? This has been a very puzzling thing and I would  
appreciate if anyone could help.

Thank you.

Xuanyi Chew  
+61403928398

On Sun, May 5, 2013 at 6:06 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> May be script filters could help here:  
> [GitHub - elastic/elasticsearch-river-couchdb: CouchDB River Plugin for elasticsearch (STOPPED)](https://github.com/elasticsearch/elasticsearch-river-couchdb#script-filters)
> 
> {  
> "type" : "couchdb",  
> "couchdb" : { "script" : "ctx.doc.field1 = ctx.doc.field1\>1000000? 0: ctx.doc.field1"  
> }  
> }
> 
> Or something like that...  
> HTH
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 5 mai 2013 à 04:09, Chewxy [chewxy@gmail.com](mailto:chewxy@gmail.com) a écrit :
> 
> Hello,  
> I seem to be running into some trouble with Elasticsearch and the CouchDB  
> River plugin.
> 
> When elasticsearch indexes my database \_changes, it runs into this problem:
> 
> Exception in thread "elasticsearch[Trapper][couchdb\_river\_indexer][T#1]"
> 
> > org.elasticsearch.ElasticSearchIllegalStateException: No matching token for  
> > number\_type [BIG\_INTEGER]  
> > at  
> > org.elasticsearch.common.xcontent.json.JsonXContentParser.convertNumberType(JsonXContentParser.java:206)  
> > at  
> > org.elasticsearch.common.xcontent.json.JsonXContentParser.numberType(JsonXContentParser.java:65)  
> > at  
> > org.elasticsearch.common.xcontent.support.XContentMapConverter.readValue(XContentMapConverter.java:97)  
> > at  
> > org.elasticsearch.common.xcontent.support.XContentMapConverter.readMap(XContentMapConverter.java:77)  
> > at  
> > org.elasticsearch.common.xcontent.support.XContentMapConverter.readValue(XContentMapConverter.java:110)  
> > at  
> > org.elasticsearch.common.xcontent.support.XContentMapConverter.readMap(XContentMapConverter.java:77)  
> > at  
> > org.elasticsearch.common.xcontent.support.XContentMapConverter.readMap(XContentMapConverter.java:56)  
> > at  
> > org.elasticsearch.common.xcontent.support.AbstractXContentParser.map(AbstractXContentParser.java:121)  
> > at  
> > org.elasticsearch.common.xcontent.support.AbstractXContentParser.mapAndClose(AbstractXContentParser.java:132)  
> > at  
> > org.elasticsearch.river.couchdb.CouchdbRiver.processLine(CouchdbRiver.java:218)  
> > at  
> > org.elasticsearch.river.couchdb.CouchdbRiver.access$500(CouchdbRiver.java:64)  
> > at  
> > org.elasticsearch.river.couchdb.CouchdbRiver$Indexer.run(CouchdbRiver.java:334)  
> > at java.lang.Thread.run(Thread.java:679)
> 
> This is because I have a number of documents in my database with field  
> values that look like 4634970607942323000.
> 
> I have googled around, and tried filtering, but filtering seems to only  
> lead to filtering of document types (or documents with certain fields and  
> values). I don't seem to be able to filter out fields from being indexed.
> 
> These are my solutions so far, with notes in parens:
> 
> - rewrite all field values in couchdb with BIG\_INTEGER to smaller  
> values (problem: I tried doing that, and still ran into the same problem,  
> albeit now I have more documents indexed. I suspect the issue is with  
> unknown fields with large integers. I have no idea where Elasticsearch  
> stopped indexing and even logging level set to TRACE yielded no clues)
> - cast all field values from \_changes to strings (only a few fields  
> matter in my documents, and those that have integers in them are meta data  
> usually. I tried with custom mapping and got terribly muddled)
> - make couchdb-river ignore certain fields when indexing documents (I  
> have no idea how to do that. I read the filtering documentation, and  
> managed to filter only documents with certain fields and certain values for  
> the fields, but that's not what I want)
> - make couchdb-river ignore fields when error occurs. (I have no idea  
> how to do this either)
> 
> So, Elasticsearch community, help me, you're my only hope 😛
> 
> --  
> 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).
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/vxhg1sw8ikE/unsubscribe?hl=en-US](https://groups.google.com/d/topic/elasticsearch/vxhg1sw8ikE/unsubscribe?hl=en-US)  
> .  
> To unsubscribe from this group and all its topics, 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).

--  
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:36am UTC](https://discuss.elastic.co/t/elasticsearch-couchdb-big-integer-oh-my/11815/4 "2017-07-06T02:36:47Z")

</div>


