# How to create index for a attachment of a doc in couchDB with ES?

**URL:** <https://discuss.elastic.co/t/how-to-create-index-for-a-attachment-of-a-doc-in-couchdb-with-es/6026>\
**Category:** Elasticsearch\
**Created:** [November 30, 2011, 1:52pm UTC](https://discuss.elastic.co/t/how-to-create-index-for-a-attachment-of-a-doc-in-couchdb-with-es/6026 "2011-11-30T13:52:43Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Goog\_Jobs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/goog_jobs/32/2894_2.png) [@Goog\_Jobs](https://discuss.elastic.co/u/Goog_Jobs)\
**Post date:** [November 30, 2011, 1:52pm UTC](https://discuss.elastic.co/t/how-to-create-index-for-a-attachment-of-a-doc-in-couchdb-with-es/6026/1 "2011-11-30T13:52:43Z")

</div>

THE method [[http://www.elasticsearch.org/tutorials/2011/07/18/](http://www.elasticsearch.org/tutorials/2011/07/18/)  
attachment-type-in-action.html] is ok,but not simple.  
is there a simple way. Thanks!

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [November 30, 2011, 2:01pm UTC](https://discuss.elastic.co/t/how-to-create-index-for-a-attachment-of-a-doc-in-couchdb-with-es/6026/2 "2011-11-30T14:01:20Z")

</div>

On Wed, 2011-11-30 at 05:52 -0800, cheng wrote:

> THE method [[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/tutorials/2011/07/18/)  
> attachment-type-in-action.html] is ok,but not simple.  
> is there a simple way. Thanks!

Cheng, if you want a useful response, you're really going to have to ask  
specific questions which explain

- what you've tried,
- the problem you've had,
- and what you want to know.

Currently, my only useful answer to your questions would be: hire  
somebody to do this for you.

have a look at [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help) for more information  
about how to ask questions which are likely to get responses

clint

---

<div class="post-metadata">

**Author:** ![Goog\_Jobs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/goog_jobs/32/2894_2.png) [@Goog\_Jobs](https://discuss.elastic.co/u/Goog_Jobs)\
**Post date:** [November 30, 2011, 2:07pm UTC](https://discuss.elastic.co/t/how-to-create-index-for-a-attachment-of-a-doc-in-couchdb-with-es/6026/3 "2011-11-30T14:07:53Z")

</div>

Thanks. i have tried the Attachment Type in Action,but the method  
can't index the attachments in couchDB automatically . i want a way to  
make it .

On Nov 30, 10:01 pm, Clinton Gormley [cl...@traveljury.com](mailto:cl...@traveljury.com) wrote:

> On Wed, 2011-11-30 at 05:52 -0800, cheng wrote:
> 
> > THE method [[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/tutorials/2011/07/18/)  
> > attachment-type-in-action.html] is ok,but not simple.  
> > is there a simple way. Thanks!
> 
> Cheng, if you want a useful response, you're really going to have to ask  
> specific questions which explain
> 
> - what you've tried,
> - the problem you've had,
> - and what you want to know.
> 
> Currently, my only useful answer to your questions would be: hire  
> somebody to do this for you.
> 
> have a look athttp://www.elasticsearch.org/helpfor more information  
> about how to ask questions which are likely to get responses
> 
> clint

---

<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:** [November 30, 2011, 2:20pm UTC](https://discuss.elastic.co/t/how-to-create-index-for-a-attachment-of-a-doc-in-couchdb-with-es/6026/4 "2011-11-30T14:20:42Z")

</div>

I would say that it remains a TODO for that in [https://github.com/elasticsearch/elasticsearch/blob/master/plugins/river/couchdb/src/main/java/org/elasticsearch/river/couchdb/CouchdbRiver.java](https://github.com/elasticsearch/elasticsearch/blob/master/plugins/river/couchdb/src/main/java/org/elasticsearch/river/couchdb/CouchdbRiver.java)  
Line 271

I don't think it's difficult to implement it... I probably work on it if nobody code it in the next months...

David 😉  
@dadoonet

Le 30 nov. 2011 à 14:52, cheng [googcheng@gmail.com](mailto:googcheng@gmail.com) a écrit :

> THE method [[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/tutorials/2011/07/18/)  
> attachment-type-in-action.html] is ok,but not simple.  
> is there a simple way. Thanks!

---

<div class="post-metadata">

**Author:** ![Goog\_Jobs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/goog_jobs/32/2894_2.png) [@Goog\_Jobs](https://discuss.elastic.co/u/Goog_Jobs)\
**Post date:** [December 1, 2011, 8:53am UTC](https://discuss.elastic.co/t/how-to-create-index-for-a-attachment-of-a-doc-in-couchdb-with-es/6026/5 "2011-12-01T08:53:27Z")

</div>

I'M a beginner,but i would like to build a search engine to index  
documents like .pdf .doc etc. Now i don't no how to do it .may be have  
to halt it.  
i use tapirwiki(a couchapp) to upload the docs.the method can't index  
the attachments in couchDB automatically . man! expect your code .

best regards @funse [[weibo.com](http://weibo.com)]

On Nov 30, 10:20 pm, David Pilato [da...@pilato.fr](mailto:da...@pilato.fr) wrote:

> I would say that it remains a TODO for that inhttps://github.com/elasticsearch/elasticsearch/blob/master/plugins/ri...  
> Line 271
> 
> I don't think it's difficult to implement it... I probably work on it if nobody code it in the next months...
> 
> David 😉  
> @dadoonet
> 
> Le 30 nov. 2011 à 14:52, cheng [googch...@gmail.com](mailto:googch...@gmail.com) a écrit :
> 
> > THE method [[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/tutorials/2011/07/18/)  
> > attachment-type-in-action.html] is ok,but not simple.  
> > is there a simple way. Thanks!

---

<div class="post-metadata">

**Author:** ![Goog\_Jobs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/goog_jobs/32/2894_2.png) [@Goog\_Jobs](https://discuss.elastic.co/u/Goog_Jobs)\
**Post date:** [December 20, 2011, 7:07am UTC](https://discuss.elastic.co/t/how-to-create-index-for-a-attachment-of-a-doc-in-couchdb-with-es/6026/6 "2011-12-20T07:07:39Z")

</div>

Hi,man ! do u finish the code ? could u share it with me ! Thanks very  
much!

在 2011年11月30日星期三，David Pilato 写道：

> I would say that it remains a TODO for that in  
> [https://github.com/elasticsearch/elasticsearch/blob/master/plugins/river/couchdb/src/main/java/org/elasticsearch/river/couchdb/CouchdbRiver.java](https://github.com/elasticsearch/elasticsearch/blob/master/plugins/river/couchdb/src/main/java/org/elasticsearch/river/couchdb/CouchdbRiver.java)  
> Line 271
> 
> I don't think it's difficult to implement it... I probably work on it if  
> nobody code it in the next months...
> 
> David 😉  
> @dadoonet
> 
> Le 30 nov. 2011 à 14:52, cheng \<[googcheng@gmail.com](mailto:googcheng@gmail.com) \<javascript:;\>\> a  
> écrit :
> 
> > THE method [[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/tutorials/2011/07/18/)  
> > attachment-type-in-action.html] is ok,but not simple.  
> > is there a simple way. Thanks!

---

<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:** [December 21, 2011, 11:11pm UTC](https://discuss.elastic.co/t/how-to-create-index-for-a-attachment-of-a-doc-in-couchdb-with-es/6026/7 "2011-12-21T23:11:01Z")

</div>

Hi there,

I just finished something to deal with couchDb attachments using elasticsearch-mapper-attachments.

Before going further, is it possible for you to fork my code [1], compile it and launch the main test class CouchdbRiverBinaryAttachementTest and send some docs with one or more attachments and see if you can search for it ?

I tried with a very simple PDF file and it seems to work fine.

I start to write a little documentation about it [2] (see at the end).

You can also download the plugin [3] and install it instead of the previous couchDb plugin.

BTW, you should have installed before the elasticsearch-mapper-attachments plugin [4].

Please let me know if it’s working or not for you.

Cheers,

David.

[1] [https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments](https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments)

[2] [https://github.com/dadoonet/elasticsearch.github.com/blob/b77ebec4e44c5d794d68cfd3c79fd2b3db2b120c/guide/reference/river/couchdb.textile](https://github.com/dadoonet/elasticsearch.github.com/blob/b77ebec4e44c5d794d68cfd3c79fd2b3db2b120c/guide/reference/river/couchdb.textile)

[3] [https://github.com/downloads/dadoonet/elasticsearch-river-couchdb/elasticsearch-river-couchdb-1.1.0-SNAPSHOT.zip](https://github.com/downloads/dadoonet/elasticsearch-river-couchdb/elasticsearch-river-couchdb-1.1.0-SNAPSHOT.zip)

[4] [GitHub - elastic/elasticsearch-mapper-attachments: Mapper Attachments Type plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-mapper-attachments)

De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [[mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)] De la part de goog cheng  
Envoyé : mardi 20 décembre 2011 08:08  
À : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
Objet : Re: how to create index for a attachment of a doc in couchDB with ES?

Hi,man ! do u finish the code ? could u share it with me ! Thanks very much!

在 2011年11月30日星期三，David Pilato 写道：

I would say that it remains a TODO for that in [https://github.com/elasticsearch/elasticsearch/blob/master/plugins/river/couchdb/src/main/java/org/elasticsearch/river/couchdb/CouchdbRiver.java](https://github.com/elasticsearch/elasticsearch/blob/master/plugins/river/couchdb/src/main/java/org/elasticsearch/river/couchdb/CouchdbRiver.java)  
Line 271

I don't think it's difficult to implement it... I probably work on it if nobody code it in the next months...

David 😉  
@dadoonet

Le 30 nov. 2011 à 14:52, cheng \<[googcheng@gmail.com](mailto:googcheng@gmail.com) \<javascript:;\> \> a écrit :

> THE method [[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/tutorials/2011/07/18/)  
> attachment-type-in-action.html] is ok,but not simple.  
> is there a simple way. Thanks!

---

<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:** [December 28, 2011, 1:12pm UTC](https://discuss.elastic.co/t/how-to-create-index-for-a-attachment-of-a-doc-in-couchdb-with-es/6026/8 "2011-12-28T13:12:54Z")

</div>

Did anyone test it ?

BTW, I updated the README file :  
[https://github.com/dadoonet/elasticsearch-river-couchdb/blob/attachments/README.md](https://github.com/dadoonet/elasticsearch-river-couchdb/blob/attachments/README.md)  
Please let me know (CouchDB river users) if there is any regression or  
if I can submit the pull request.

Thanks,  
David.

On 22 déc, 00:11, "David Pilato" [da...@pilato.fr](mailto:da...@pilato.fr) wrote:

> Hi there,
> 
> I just finished something to deal with couchDb attachments using elasticsearch-mapper-attachments.
> 
> Before going further, is it possible for you to fork my code [1], compile it and launch the main test class CouchdbRiverBinaryAttachementTest and send some docs with one or more attachments and see if you can search for it ?
> 
> I tried with a very simple PDF file and it seems to work fine.
> 
> I start to write a little documentation about it [2] (see at the end).
> 
> You can also download the plugin [3] and install it instead of the previous couchDb plugin.
> 
> BTW, you should have installed before the elasticsearch-mapper-attachments plugin [4].
> 
> Please let me know if it’s working or not for you.
> 
> Cheers,
> 
> David.
> 
> [1][https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments](https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments)  
> [2][GitHub - dadoonet/elasticsearch.github.com at b77ebec4e44c5d794d68cfd3c79fd2b3db2b120c](https://github.com/dadoonet/elasticsearch.github.com/blob/b77ebec4e44)...  
> [3][https://github.com/downloads/dadoonet/elasticsearch-river-couchdb/ela](https://github.com/downloads/dadoonet/elasticsearch-river-couchdb/ela)...  
> [4][GitHub - elastic/elasticsearch-mapper-attachments: Mapper Attachments Type plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-mapper-attachments)

---

<div class="post-metadata">

**Author:** ![dungtc](https://avatars.discourse-cdn.com/v4/letter/d/858c86/32.png) [@dungtc](https://discuss.elastic.co/u/dungtc)\
**Post date:** [December 29, 2011, 3:42pm UTC](https://discuss.elastic.co/t/how-to-create-index-for-a-attachment-of-a-doc-in-couchdb-with-es/6026/9 "2011-12-29T15:42:08Z")

</div>

Hello  
I have tested it but it doesnot work well.

I attach 4 files to the 2 couchdb documents like that:  
{  
"\_id": "Doc1",  
"\_rev": "5-4d607b7d88985097462ae9b2f67bc5ac",  
"message": "Elastic Search",  
"\_attachments": {  
"exam.docx": {  
"content\_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",  
"revpos": 4,  
"digest": "md5-ecdBcsbc6w7mC1EOgd5SIg==",  
"length": 10007,  
"stub": true  
},  
"2230681.pdf": {  
"content\_type": "application/pdf",  
"revpos": 2,  
"digest": "md5-BUhqhHiVqKybxrfGsQTixQ==",  
"length": 956146,  
"stub": true  
}  
}  
}

{  
"\_id": "Doc2",  
"\_rev": "7-dd58025abc2002566b6f458ad3d83d4d",  
"message": test attachments",  
"\_attachments": {  
"TestAttachments.txt": {  
"content\_type": "text/plain",  
"revpos": 6,  
"digest": "md5-aLTD+adMRHPw2+WMIN/42Q==",  
"length": 89,  
"stub": true  
},  
"DynamicPublishingUseCases.doc": {  
"content\_type": "application/msword",  
"revpos": 2,  
"digest": "md5-FRdhydLr57C+q3ff6xLEmA==",  
"length": 22528,  
"stub": true  
}  
}  
}

Here is my test with Elasticsearch:  
curl -X  
PUT "localhost:9200/test\_idx\_couchdb\_attachments"  
{"ok":true,"acknowledged":true}

curl -XPUT '[http://localhost:9200/\_river/test\_river\_couchdb\_attachments/\_meta](http://localhost:9200/_river/test_river_couchdb_attachments/_meta)' -d  
'{"type" : "couchdb", "couchdb" : {"host" : "localhost","port" :  
5984,"db" : "my\_test\_couchdb\_attachments","filter" :  
null,"ignore\_attachments":false}},"index" : {"index" :  
"test\_idx\_couchdb\_attachments", "type" :  
"test\_mapping\_couchdb\_attachments" } }'  
{"ok":true,"\_index":"\_river","\_type":"test\_river\_couchdb\_attachments","\_id":"\_meta","\_version":1}

At first, I type:

curl -X PUT [http://127.0.0.1:9200/my\_test\_couchdb\_attachments/my\_test\_couchdb\_attachments/\_mapping](http://127.0.0.1:9200/my_test_couchdb_attachments/my_test_couchdb_attachments/_mapping) -d '{  
"my\_test\_couchdb\_attachments": {  
"properties": {  
"\_attachments": {  
"properties": {  
"2230681.pdf": {  
"type": "attachment", "index" : "analyzed"  
},  
"DynamicPublishingUseCases.doc": {  
"type": "attachment", "index" : "analyzed"  
},  
"TestAttachments.txt": {  
"type": "attachment", "index" : "analyzed"  
},  
"exam.docx": {  
"type": "attachment", "index" : "analyzed"  
}  
}  
},  
"message" : {  
"type": "string", "index" : "analyzed"  
}  
}  
}  
}'  
and I receive results:  
{"error":"MergeMappingException[Merge failed with failures {[Can't merge a non object mapping [TestAttachments.txt] with an object mapping [TestAttachments.txt], Can't merge a non object mapping [2230681.pdf] with an object mapping [2230681.pdf], Can't merge a non object mapping [exam.docx] with an object mapping [exam.docx], Can't merge a non object mapping [DynamicPublishingUseCases.doc] with an object mapping [DynamicPublishingUseCases.doc]]}]

So I change and I succeed:  
curl -X PUT [http://127.0.0.1:9200/my\_test\_couchdb\_attachments/my\_test\_couchdb\_attachments/\_mapping](http://127.0.0.1:9200/my_test_couchdb_attachments/my_test_couchdb_attachments/_mapping) -d '{  
"my\_test\_couchdb\_attachments": {  
"properties": {  
"\_attachments": {  
"properties": {  
""2230681.pdf"": {  
"type": "attachment", "index" : "analyzed"  
},  
""DynamicPublishingUseCases.doc"": {  
"type": "attachment", "index" : "analyzed"  
},  
""TestAttachments.txt"": {  
"type": "attachment", "index" : "analyzed"  
},  
""exam.docx"": {  
"type": "attachment", "index" : "analyzed"  
}  
}  
},  
"message" : {  
"type": "string", "index" : "analyzed"  
}  
}  
}  
}'  
{"ok":true,"acknowledged":true}

curl -XPOST '[http://localhost:9200/my\_test\_couchdb\_attachments/my\_test\_couchdb\_attachments/\_search?pretty=true](http://localhost:9200/my_test_couchdb_attachments/my_test_couchdb_attachments/_search?pretty=true)' -d '{"query" : {"wildcard" : { "\_all" : "\*" } } }'  
This query works well by returning two documents

these queries donot work well with errors or no expected results:

curl -XGET '[http://localhost:9200/my\_test\_couchdb\_attachments/my\_test\_couchdb\_attachments/\_search](http://localhost:9200/my_test_couchdb_attachments/my_test_couchdb_attachments/_search)' -d '{"query" : {"text" : { "\_attachments."2230681.pdf".content" : "Temperature" } } }'  
{"took":0,"timed\_out":false,"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max\_score":null,"hits":}}

curl -XGET '[http://localhost:9200/my\_test\_couchdb\_attachments/my\_test\_couchdb\_attachments/\_search](http://localhost:9200/my_test_couchdb_attachments/my_test_couchdb_attachments/_search)' -d '{"query" : {"text" : { "\_attachments.[2230681.pdf] : "Temperature" } } }'  
{"error":"SearchPhaseExecutionException[Failed to execute phase [query], total failure; shardFailures {[CHYAFYCERMGHlBvKHiEagA][my\_test\_couchdb\_attachments][3]: SearchParseException[[my\_test\_couchdb\_attachments][3]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query" : {"text" : { "\_attachments.[2230681.pdf] : "Temperature" } } }]]]; nested: QueryParsingException[[my\_test\_couchdb\_attachments] Failed to parse]; nested: JsonParseException[Unexpected character ('T' (code 84)): was expecting a colon to separate field name and value\n at [Source: [B@582a85; line: 1, column: 56]]; }]

curl -XPOST '[http://localhost:9200/my\_test\_couchdb\_attachments/my\_test\_couchdb\_attachments/\_search?pretty=true](http://localhost:9200/my_test_couchdb_attachments/my_test_couchdb_attachments/_search?pretty=true)' -d '{"query" : {"text" : { "\_attachments."DynamicPublishingUseCases.doc"" : "Rendering" } } }'  
{  
"took" : 0,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 0,  
"max\_score" : null,  
"hits" :   
}  
}

curl -XPOST '[http://localhost:9200/my\_test\_couchdb\_attachments/my\_test\_couchdb\_attachments/\_search?pretty=true](http://localhost:9200/my_test_couchdb_attachments/my_test_couchdb_attachments/_search?pretty=true)' -d '{"query" : {"text\_phrase" : { "\_attachments."TestAttachments.txt"" : "Couchdb" } } }'  
{  
"took" : 0,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 0,  
"max\_score" : null,  
"hits" :   
}  
}

I have used Elastic search 0.18.4 with river Couchdb 1.1.0 and mapper-attachments plugins 1.1.0  
Please explain to me and how to index couchdb attachments and make it searchable?  
Maybe I should submit the pdf files whose content is encoded with base64? All my files in my test arenot encoded.  
Thanks a lot

* * *

* * *

De : David Pilato [david@pilato.fr](mailto:david@pilato.fr)  
À : elasticsearch [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
Envoyé le : Mercredi 28 Décembre 2011 14h12  
Objet : Re: how to create index for a attachment of a doc in couchDB with ES?

Did anyone test it ?

BTW, I updated the README file :  
[https://github.com/dadoonet/elasticsearch-river-couchdb/blob/attachments/README.md](https://github.com/dadoonet/elasticsearch-river-couchdb/blob/attachments/README.md)  
Please let me know (CouchDB river users) if there is any regression or  
if I can submit the pull request.

Thanks,  
David.

On 22 déc, 00:11, "David Pilato" [da...@pilato.fr](mailto:da...@pilato.fr) wrote:

> Hi there,
> 
> I just finished something to deal with couchDb attachments using elasticsearch-mapper-attachments.
> 
> Before going further, is it possible for you to fork my code [1], compile it and launch the main test class CouchdbRiverBinaryAttachementTest and send some docs with one or more attachments and see if you can search for it ?
> 
> I tried with a very simple PDF file and it seems to work fine.
> 
> I start to write a little documentation about it [2] (see at the end).
> 
> You can also download the plugin [3] and install it instead of the previous couchDb plugin.
> 
> BTW, you should have installed before the elasticsearch-mapper-attachments plugin [4].
> 
> Please let me know if it’s working or not for you.
> 
> Cheers,
> 
> David.
> 
> [1][https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments](https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments)  
> [2][GitHub - dadoonet/elasticsearch.github.com at b77ebec4e44c5d794d68cfd3c79fd2b3db2b120c](https://github.com/dadoonet/elasticsearch.github.com/blob/b77ebec4e44)...  
> [3][https://github.com/downloads/dadoonet/elasticsearch-river-couchdb/ela](https://github.com/downloads/dadoonet/elasticsearch-river-couchdb/ela)...  
> [4][GitHub - elastic/elasticsearch-mapper-attachments: Mapper Attachments Type plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-mapper-attachments)

---

<div class="post-metadata">

**Author:** ![Goog\_Jobs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/goog_jobs/32/2894_2.png) [@Goog\_Jobs](https://discuss.elastic.co/u/Goog_Jobs)\
**Post date:** [January 7, 2012, 7:49am UTC](https://discuss.elastic.co/t/how-to-create-index-for-a-attachment-of-a-doc-in-couchdb-with-es/6026/10 "2012-01-07T07:49:43Z")

</div>

sorry,few days ago, i was busy to take examinations.I will do it now.

On Dec 22 2011, 7:11 am, "David Pilato" [da...@pilato.fr](mailto:da...@pilato.fr) wrote:

> Hi there,
> 
> I just finished something to deal with couchDb attachments using elasticsearch-mapper-attachments.
> 
> Before going further, is it possible for you to fork my code [1], compile it and launch the main test class CouchdbRiverBinaryAttachementTest and send some docs with one or more attachments and see if you can search for it ?
> 
> I tried with a very simple PDF file and it seems to work fine.
> 
> I start to write a little documentation about it [2] (see at the end).
> 
> You can also download the plugin [3] and install it instead of the previous couchDb plugin.
> 
> BTW, you should have installed before the elasticsearch-mapper-attachments plugin [4].
> 
> Please let me know if it’s working or not for you.
> 
> Cheers,
> 
> David.
> 
> [1][https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments](https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments)
> 
> [2][GitHub - dadoonet/elasticsearch.github.com at b77ebec4e44c5d794d68cfd3c79fd2b3db2b120c](https://github.com/dadoonet/elasticsearch.github.com/blob/b77ebec4e44)...
> 
> [3][https://github.com/downloads/dadoonet/elasticsearch-river-couchdb/ela](https://github.com/downloads/dadoonet/elasticsearch-river-couchdb/ela)...
> 
> [4][GitHub - elastic/elasticsearch-mapper-attachments: Mapper Attachments Type plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-mapper-attachments)
> 
> De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [[mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)] De la part de goog cheng  
> Envoyé : mardi 20 décembre 2011 08:08  
> À : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> Objet : Re: how to create index for a attachment of a doc in couchDB with ES?
> 
> Hi,man ! do u finish the code ? could u share it with me ! Thanks very much!
> 
> 在 2011年11月30日星期三，David Pilato 写道：
> 
> I would say that it remains a TODO for that inhttps://github.com/elasticsearch/elasticsearch/blob/master/plugins/ri...  
> Line 271
> 
> I don't think it's difficult to implement it... I probably work on it if nobody code it in the next months...
> 
> David 😉  
> @dadoonet
> 
> Le 30 nov. 2011 à 14:52, cheng \<[googch...@gmail.com](mailto:googch...@gmail.com) \<javascript:;\> \> a écrit :
> 
> > THE method [[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/tutorials/2011/07/18/)  
> > attachment-type-in-action.html] is ok,but not simple.  
> > is there a simple way. Thanks!

---

<div class="post-metadata">

**Author:** ![Goog\_Jobs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/goog_jobs/32/2894_2.png) [@Goog\_Jobs](https://discuss.elastic.co/u/Goog_Jobs)\
**Post date:** [January 7, 2012, 10:10am UTC](https://discuss.elastic.co/t/how-to-create-index-for-a-attachment-of-a-doc-in-couchdb-with-es/6026/11 "2012-01-07T10:10:00Z")

</div>

man,it doesn't work well. the content of the attachement after  
searching is chars which have no meanings,like  
"kAGEkADEkACokAUEkAAAzAEIqAE9KAwBRSgMAQ0oYAHN".

On Dec 28 2011, 9:12 pm, David Pilato [da...@pilato.fr](mailto:da...@pilato.fr) wrote:

> Did anyone test it ?
> 
> BTW, I updated the README file :[https://github.com/dadoonet/elasticsearch-river-couchdb/blob/attachme](https://github.com/dadoonet/elasticsearch-river-couchdb/blob/attachme)...  
> Please let me know (CouchDB river users) if there is any regression or  
> if I can submit the pull request.
> 
> Thanks,  
> David.
> 
> On 22 déc, 00:11, "David Pilato" [da...@pilato.fr](mailto:da...@pilato.fr) wrote:
> 
> > Hi there,
> 
> > I just finished something to deal with couchDb attachments using elasticsearch-mapper-attachments.
> 
> > Before going further, is it possible for you to fork my code [1], compile it and launch the main test class CouchdbRiverBinaryAttachementTest and send some docs with one or more attachments and see if you can search for it ?
> 
> > I tried with a very simple PDF file and it seems to work fine.
> 
> > I start to write a little documentation about it [2] (see at the end).
> 
> > You can also download the plugin [3] and install it instead of the previous couchDb plugin.
> 
> > BTW, you should have installed before the elasticsearch-mapper-attachments plugin [4].
> 
> > Please let me know if it’s working or not for you.
> 
> > Cheers,
> 
> > David.
> 
> > [1][https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments](https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments)  
> > [2][GitHub - dadoonet/elasticsearch.github.com at b77ebec4e44c5d794d68cfd3c79fd2b3db2b120c](https://github.com/dadoonet/elasticsearch.github.com/blob/b77ebec4e44)...  
> > [3][https://github.com/downloads/dadoonet/elasticsearch-river-couchdb/ela](https://github.com/downloads/dadoonet/elasticsearch-river-couchdb/ela)...  
> > [4][GitHub - elastic/elasticsearch-mapper-attachments: Mapper Attachments Type plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-mapper-attachments)

---

<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:** [January 7, 2012, 10:17am UTC](https://discuss.elastic.co/t/how-to-create-index-for-a-attachment-of-a-doc-in-couchdb-with-es/6026/12 "2012-01-07T10:17:18Z")

</div>

It's BASE64 encoded but you can perform searches.  
Search for a term which is in your doc, you should find your doc.

David 😉  
@dadoonet

Le 7 janv. 2012 à 11:10, Goog Cheng [googcheng@gmail.com](mailto:googcheng@gmail.com) a écrit :

> man,it doesn't work well. the content of the attachement after  
> searching is chars which have no meanings,like  
> "kAGEkADEkACokAUEkAAAzAEIqAE9KAwBRSgMAQ0oYAHN".
> 
> On Dec 28 2011, 9:12 pm, David Pilato [da...@pilato.fr](mailto:da...@pilato.fr) wrote:
> 
> > Did anyone test it ?
> > 
> > BTW, I updated the README file :[https://github.com/dadoonet/elasticsearch-river-couchdb/blob/attachme](https://github.com/dadoonet/elasticsearch-river-couchdb/blob/attachme)...  
> > Please let me know (CouchDB river users) if there is any regression or  
> > if I can submit the pull request.
> > 
> > Thanks,  
> > David.
> > 
> > On 22 déc, 00:11, "David Pilato" [da...@pilato.fr](mailto:da...@pilato.fr) wrote:
> > 
> > > Hi there,
> > 
> > > I just finished something to deal with couchDb attachments using elasticsearch-mapper-attachments.
> > 
> > > Before going further, is it possible for you to fork my code [1], compile it and launch the main test class CouchdbRiverBinaryAttachementTest and send some docs with one or more attachments and see if you can search for it ?
> > 
> > > I tried with a very simple PDF file and it seems to work fine.
> > 
> > > I start to write a little documentation about it [2] (see at the end).
> > 
> > > You can also download the plugin [3] and install it instead of the previous couchDb plugin.
> > 
> > > BTW, you should have installed before the elasticsearch-mapper-attachments plugin [4].
> > 
> > > Please let me know if it’s working or not for you.
> > 
> > > Cheers,
> > 
> > > David.
> > 
> > > [1][https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments](https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments)  
> > > [2][GitHub - dadoonet/elasticsearch.github.com at b77ebec4e44c5d794d68cfd3c79fd2b3db2b120c](https://github.com/dadoonet/elasticsearch.github.com/blob/b77ebec4e44)...  
> > > [3][https://github.com/downloads/dadoonet/elasticsearch-river-couchdb/ela](https://github.com/downloads/dadoonet/elasticsearch-river-couchdb/ela)...  
> > > [4][GitHub - elastic/elasticsearch-mapper-attachments: Mapper Attachments Type plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-mapper-attachments)

---

<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:** [January 7, 2012, 10:18am UTC](https://discuss.elastic.co/t/how-to-create-index-for-a-attachment-of-a-doc-in-couchdb-with-es/6026/13 "2012-01-07T10:18:20Z")

</div>

When you get your hit, you have to decode it (Base64)

David 😉  
@dadoonet

Le 7 janv. 2012 à 11:10, Goog Cheng [googcheng@gmail.com](mailto:googcheng@gmail.com) a écrit :

> man,it doesn't work well. the content of the attachement after  
> searching is chars which have no meanings,like  
> "kAGEkADEkACokAUEkAAAzAEIqAE9KAwBRSgMAQ0oYAHN".
> 
> On Dec 28 2011, 9:12 pm, David Pilato [da...@pilato.fr](mailto:da...@pilato.fr) wrote:
> 
> > Did anyone test it ?
> > 
> > BTW, I updated the README file :[https://github.com/dadoonet/elasticsearch-river-couchdb/blob/attachme](https://github.com/dadoonet/elasticsearch-river-couchdb/blob/attachme)...  
> > Please let me know (CouchDB river users) if there is any regression or  
> > if I can submit the pull request.
> > 
> > Thanks,  
> > David.
> > 
> > On 22 déc, 00:11, "David Pilato" [da...@pilato.fr](mailto:da...@pilato.fr) wrote:
> > 
> > > Hi there,
> > 
> > > I just finished something to deal with couchDb attachments using elasticsearch-mapper-attachments.
> > 
> > > Before going further, is it possible for you to fork my code [1], compile it and launch the main test class CouchdbRiverBinaryAttachementTest and send some docs with one or more attachments and see if you can search for it ?
> > 
> > > I tried with a very simple PDF file and it seems to work fine.
> > 
> > > I start to write a little documentation about it [2] (see at the end).
> > 
> > > You can also download the plugin [3] and install it instead of the previous couchDb plugin.
> > 
> > > BTW, you should have installed before the elasticsearch-mapper-attachments plugin [4].
> > 
> > > Please let me know if it’s working or not for you.
> > 
> > > Cheers,
> > 
> > > David.
> > 
> > > [1][https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments](https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments)  
> > > [2][GitHub - dadoonet/elasticsearch.github.com at b77ebec4e44c5d794d68cfd3c79fd2b3db2b120c](https://github.com/dadoonet/elasticsearch.github.com/blob/b77ebec4e44)...  
> > > [3][https://github.com/downloads/dadoonet/elasticsearch-river-couchdb/ela](https://github.com/downloads/dadoonet/elasticsearch-river-couchdb/ela)...  
> > > [4][GitHub - elastic/elasticsearch-mapper-attachments: Mapper Attachments Type plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-mapper-attachments)

---

<div class="post-metadata">

**Author:** ![Goog\_Jobs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/goog_jobs/32/2894_2.png) [@Goog\_Jobs](https://discuss.elastic.co/u/Goog_Jobs)\
**Post date:** [January 7, 2012, 10:39am UTC](https://discuss.elastic.co/t/how-to-create-index-for-a-attachment-of-a-doc-in-couchdb-with-es/6026/14 "2012-01-07T10:39:13Z")

</div>

I used the restful ,search the given word the attachment contains  
it ,but no hit.

curl "localhost:9200/tapirwiki/tapirwiki\_search?pretty=true" -d '{  
"query" : {  
"query\_string" : {  
"query" : "svm"  
}  
}  
}'  
{  
"took" : 6,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 0,  
"max\_score" : null,  
"hits" :   
}

On Jan 7, 6:18 pm, David Pilato [da...@pilato.fr](mailto:da...@pilato.fr) wrote:

> When you get your hit, you have to decode it (Base64)
> 
> David 😉  
> @dadoonet
> 
> Le 7 janv. 2012 à 11:10, Goog Cheng [googch...@gmail.com](mailto:googch...@gmail.com) a écrit :
> 
> > man,it doesn't work well. the content of the attachement after  
> > searching is chars which have no meanings,like  
> > "kAGEkADEkACokAUEkAAAzAEIqAE9KAwBRSgMAQ0oYAHN".
> 
> > On Dec 28 2011, 9:12 pm, David Pilato [da...@pilato.fr](mailto:da...@pilato.fr) wrote:
> > 
> > > Did anyone test it ?
> 
> > > BTW, I updated the README file :[https://github.com/dadoonet/elasticsearch-river-couchdb/blob/attachme](https://github.com/dadoonet/elasticsearch-river-couchdb/blob/attachme)...  
> > > Please let me know (CouchDB river users) if there is any regression or  
> > > if I can submit the pull request.
> 
> > > Thanks,  
> > > David.
> 
> > > On 22 déc, 00:11, "David Pilato" [da...@pilato.fr](mailto:da...@pilato.fr) wrote:
> 
> > > > Hi there,
> 
> > > > I just finished something to deal with couchDb attachments using elasticsearch-mapper-attachments.
> 
> > > > Before going further, is it possible for you to fork my code [1], compile it and launch the main test class CouchdbRiverBinaryAttachementTest and send some docs with one or more attachments and see if you can search for it ?
> 
> > > > I tried with a very simple PDF file and it seems to work fine.
> 
> > > > I start to write a little documentation about it [2] (see at the end).
> 
> > > > You can also download the plugin [3] and install it instead of the previous couchDb plugin.
> 
> > > > BTW, you should have installed before the elasticsearch-mapper-attachments plugin [4].
> 
> > > > Please let me know if it’s working or not for you.
> 
> > > > Cheers,
> 
> > > > David.
> 
> > > > [1][https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments](https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments)  
> > > > [2][GitHub - dadoonet/elasticsearch.github.com at b77ebec4e44c5d794d68cfd3c79fd2b3db2b120c](https://github.com/dadoonet/elasticsearch.github.com/blob/b77ebec4e44)...  
> > > > [3][https://github.com/downloads/dadoonet/elasticsearch-river-couchdb/ela](https://github.com/downloads/dadoonet/elasticsearch-river-couchdb/ela)...  
> > > > [4][GitHub - elastic/elasticsearch-mapper-attachments: Mapper Attachments Type plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-mapper-attachments)

---

<div class="post-metadata">

**Author:** ![Goog\_Jobs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/goog_jobs/32/2894_2.png) [@Goog\_Jobs](https://discuss.elastic.co/u/Goog_Jobs)\
**Post date:** [January 7, 2012, 10:41am UTC](https://discuss.elastic.co/t/how-to-create-index-for-a-attachment-of-a-doc-in-couchdb-with-es/6026/15 "2012-01-07T10:41:18Z")

</div>

I use [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/tutorials/2010/08/01/couchb-integration.html)  
the quick steps, Does it have a little effect?

On Jan 7, 6:18 pm, David Pilato [da...@pilato.fr](mailto:da...@pilato.fr) wrote:

> When you get your hit, you have to decode it (Base64)
> 
> David 😉  
> @dadoonet
> 
> Le 7 janv. 2012 à 11:10, Goog Cheng [googch...@gmail.com](mailto:googch...@gmail.com) a écrit :
> 
> > man,it doesn't work well. the content of the attachement after  
> > searching is chars which have no meanings,like  
> > "kAGEkADEkACokAUEkAAAzAEIqAE9KAwBRSgMAQ0oYAHN".
> 
> > On Dec 28 2011, 9:12 pm, David Pilato [da...@pilato.fr](mailto:da...@pilato.fr) wrote:
> > 
> > > Did anyone test it ?
> 
> > > BTW, I updated the README file :[https://github.com/dadoonet/elasticsearch-river-couchdb/blob/attachme](https://github.com/dadoonet/elasticsearch-river-couchdb/blob/attachme)...  
> > > Please let me know (CouchDB river users) if there is any regression or  
> > > if I can submit the pull request.
> 
> > > Thanks,  
> > > David.
> 
> > > On 22 déc, 00:11, "David Pilato" [da...@pilato.fr](mailto:da...@pilato.fr) wrote:
> 
> > > > Hi there,
> 
> > > > I just finished something to deal with couchDb attachments using elasticsearch-mapper-attachments.
> 
> > > > Before going further, is it possible for you to fork my code [1], compile it and launch the main test class CouchdbRiverBinaryAttachementTest and send some docs with one or more attachments and see if you can search for it ?
> 
> > > > I tried with a very simple PDF file and it seems to work fine.
> 
> > > > I start to write a little documentation about it [2] (see at the end).
> 
> > > > You can also download the plugin [3] and install it instead of the previous couchDb plugin.
> 
> > > > BTW, you should have installed before the elasticsearch-mapper-attachments plugin [4].
> 
> > > > Please let me know if it’s working or not for you.
> 
> > > > Cheers,
> 
> > > > David.
> 
> > > > [1][https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments](https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments)  
> > > > [2][GitHub - dadoonet/elasticsearch.github.com at b77ebec4e44c5d794d68cfd3c79fd2b3db2b120c](https://github.com/dadoonet/elasticsearch.github.com/blob/b77ebec4e44)...  
> > > > [3][https://github.com/downloads/dadoonet/elasticsearch-river-couchdb/ela](https://github.com/downloads/dadoonet/elasticsearch-river-couchdb/ela)...  
> > > > [4][GitHub - elastic/elasticsearch-mapper-attachments: Mapper Attachments Type plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-mapper-attachments)

---

<div class="post-metadata">

**Author:** ![Goog\_Jobs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/goog_jobs/32/2894_2.png) [@Goog\_Jobs](https://discuss.elastic.co/u/Goog_Jobs)\
**Post date:** [January 7, 2012, 10:43am UTC](https://discuss.elastic.co/t/how-to-create-index-for-a-attachment-of-a-doc-in-couchdb-with-es/6026/16 "2012-01-07T10:43:35Z")

</div>

indeed ,I have got no hit.

On Jan 7, 6:18 pm, David Pilato [da...@pilato.fr](mailto:da...@pilato.fr) wrote:

> When you get your hit, you have to decode it (Base64)
> 
> David 😉  
> @dadoonet
> 
> Le 7 janv. 2012 à 11:10, Goog Cheng [googch...@gmail.com](mailto:googch...@gmail.com) a écrit :
> 
> > man,it doesn't work well. the content of the attachement after  
> > searching is chars which have no meanings,like  
> > "kAGEkADEkACokAUEkAAAzAEIqAE9KAwBRSgMAQ0oYAHN".
> 
> > On Dec 28 2011, 9:12 pm, David Pilato [da...@pilato.fr](mailto:da...@pilato.fr) wrote:
> > 
> > > Did anyone test it ?
> 
> > > BTW, I updated the README file :[https://github.com/dadoonet/elasticsearch-river-couchdb/blob/attachme](https://github.com/dadoonet/elasticsearch-river-couchdb/blob/attachme)...  
> > > Please let me know (CouchDB river users) if there is any regression or  
> > > if I can submit the pull request.
> 
> > > Thanks,  
> > > David.
> 
> > > On 22 déc, 00:11, "David Pilato" [da...@pilato.fr](mailto:da...@pilato.fr) wrote:
> 
> > > > Hi there,
> 
> > > > I just finished something to deal with couchDb attachments using elasticsearch-mapper-attachments.
> 
> > > > Before going further, is it possible for you to fork my code [1], compile it and launch the main test class CouchdbRiverBinaryAttachementTest and send some docs with one or more attachments and see if you can search for it ?
> 
> > > > I tried with a very simple PDF file and it seems to work fine.
> 
> > > > I start to write a little documentation about it [2] (see at the end).
> 
> > > > You can also download the plugin [3] and install it instead of the previous couchDb plugin.
> 
> > > > BTW, you should have installed before the elasticsearch-mapper-attachments plugin [4].
> 
> > > > Please let me know if it’s working or not for you.
> 
> > > > Cheers,
> 
> > > > David.
> 
> > > > [1][https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments](https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments)  
> > > > [2][GitHub - dadoonet/elasticsearch.github.com at b77ebec4e44c5d794d68cfd3c79fd2b3db2b120c](https://github.com/dadoonet/elasticsearch.github.com/blob/b77ebec4e44)...  
> > > > [3][https://github.com/downloads/dadoonet/elasticsearch-river-couchdb/ela](https://github.com/downloads/dadoonet/elasticsearch-river-couchdb/ela)...  
> > > > [4][GitHub - elastic/elasticsearch-mapper-attachments: Mapper Attachments Type plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-mapper-attachments)

---

<div class="post-metadata">

**Author:** ![Goog\_Jobs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/goog_jobs/32/2894_2.png) [@Goog\_Jobs](https://discuss.elastic.co/u/Goog_Jobs)\
**Post date:** [January 7, 2012, 1:26pm UTC](https://discuss.elastic.co/t/how-to-create-index-for-a-attachment-of-a-doc-in-couchdb-with-es/6026/17 "2012-01-07T13:26:54Z")

</div>

I'm very sorry,long time no es,something i get error. Good job, It's  
work well,I'm sure. Thanks very much!!!

On Jan 7, 6:18 pm, David Pilato [da...@pilato.fr](mailto:da...@pilato.fr) wrote:

> When you get your hit, you have to decode it (Base64)
> 
> David 😉  
> @dadoonet
> 
> Le 7 janv. 2012 à 11:10, Goog Cheng [googch...@gmail.com](mailto:googch...@gmail.com) a écrit :
> 
> > man,it doesn't work well. the content of the attachement after  
> > searching is chars which have no meanings,like  
> > "kAGEkADEkACokAUEkAAAzAEIqAE9KAwBRSgMAQ0oYAHN".
> 
> > On Dec 28 2011, 9:12 pm, David Pilato [da...@pilato.fr](mailto:da...@pilato.fr) wrote:
> > 
> > > Did anyone test it ?
> 
> > > BTW, I updated the README file :[https://github.com/dadoonet/elasticsearch-river-couchdb/blob/attachme](https://github.com/dadoonet/elasticsearch-river-couchdb/blob/attachme)...  
> > > Please let me know (CouchDB river users) if there is any regression or  
> > > if I can submit the pull request.
> 
> > > Thanks,  
> > > David.
> 
> > > On 22 déc, 00:11, "David Pilato" [da...@pilato.fr](mailto:da...@pilato.fr) wrote:
> 
> > > > Hi there,
> 
> > > > I just finished something to deal with couchDb attachments using elasticsearch-mapper-attachments.
> 
> > > > Before going further, is it possible for you to fork my code [1], compile it and launch the main test class CouchdbRiverBinaryAttachementTest and send some docs with one or more attachments and see if you can search for it ?
> 
> > > > I tried with a very simple PDF file and it seems to work fine.
> 
> > > > I start to write a little documentation about it [2] (see at the end).
> 
> > > > You can also download the plugin [3] and install it instead of the previous couchDb plugin.
> 
> > > > BTW, you should have installed before the elasticsearch-mapper-attachments plugin [4].
> 
> > > > Please let me know if it’s working or not for you.
> 
> > > > Cheers,
> 
> > > > David.
> 
> > > > [1][https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments](https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments)  
> > > > [2][GitHub - dadoonet/elasticsearch.github.com at b77ebec4e44c5d794d68cfd3c79fd2b3db2b120c](https://github.com/dadoonet/elasticsearch.github.com/blob/b77ebec4e44)...  
> > > > [3][https://github.com/downloads/dadoonet/elasticsearch-river-couchdb/ela](https://github.com/downloads/dadoonet/elasticsearch-river-couchdb/ela)...  
> > > > [4][GitHub - elastic/elasticsearch-mapper-attachments: Mapper Attachments Type plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-mapper-attachments)

---

<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:** [January 7, 2012, 4:20pm UTC](https://discuss.elastic.co/t/how-to-create-index-for-a-attachment-of-a-doc-in-couchdb-with-es/6026/18 "2012-01-07T16:20:53Z")

</div>

Sorry. I did not understand.  
Is it working for you or not ?

Did you try to put attachments in couchdb as I wrote it in the README here :  
[https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments](https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments) ?

I didn't test the river with inline attachments.

David.

> -----Message d'origine-----  
> De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> [[mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)] De la part de Goog Cheng  
> Envoyé : samedi 7 janvier 2012 14:27  
> À : elasticsearch  
> Objet : Re: how to create index for a attachment of a doc in couchDB  
> with ES?
> 
> I'm very sorry,long time no es,something i get error. Good job, It's  
> work well,I'm sure. Thanks very much!!!

---

<div class="post-metadata">

**Author:** ![Goog\_Jobs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/goog_jobs/32/2894_2.png) [@Goog\_Jobs](https://discuss.elastic.co/u/Goog_Jobs)\
**Post date:** [January 8, 2012, 1:06am UTC](https://discuss.elastic.co/t/how-to-create-index-for-a-attachment-of-a-doc-in-couchdb-with-es/6026/19 "2012-01-08T01:06:52Z")

</div>

work for me! I'm a chinese student, the english is so-so , sorry!

On Jan 8, 12:20 am, "David Pilato" [da...@pilato.fr](mailto:da...@pilato.fr) wrote:

> Sorry. I did not understand.  
> Is it working for you or not ?
> 
> Did you try to put attachments in couchdb as I wrote it in the README here :[https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments](https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments)?
> 
> I didn't test the river with inline attachments.
> 
> David.
> 
> > -----Message d'origine-----  
> > De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > [[mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)] De la part de Goog Cheng  
> > Envoyé : samedi 7 janvier 2012 14:27  
> > À : elasticsearch  
> > Objet : Re: how to create index for a attachment of a doc in couchDB  
> > with ES?
> 
> > I'm very sorry,long time no es,something i get error. Good job, It's  
> > work well,I'm sure. Thanks very much!!!

---

<div class="post-metadata">

**Author:** ![dungtc](https://avatars.discourse-cdn.com/v4/letter/d/858c86/32.png) [@dungtc](https://discuss.elastic.co/u/dungtc)\
**Post date:** [January 8, 2012, 1:15am UTC](https://discuss.elastic.co/t/how-to-create-index-for-a-attachment-of-a-doc-in-couchdb-with-es/6026/20 "2012-01-08T01:15:50Z")

</div>

Hi  
But it doesn'e work for me.  
I receive the same results as the mail I have already sent (below)  
Please explain it to me.  
You can see, I donot have hits.  
Did I make a mistake or not?  
Thanks

----- Mail transféré -----  
De : Chi Dung Tran [dungtctin4@yahoo.com](mailto:dungtctin4@yahoo.com)  
À : "elasticsearch@googlegroups.com" [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
Envoyé le : Jeudi 29 Décembre 2011 16h42  
Objet : Re : how to create index for a attachment of a doc in couchDB with ES?

Hello  
I have tested it but it doesnot work well.

I attach 4 files to the 2 couchdb documents like that:  
{  
"\_id": "Doc1",  
"\_rev": "5-4d607b7d88985097462ae9b2f67bc5ac",  
"message": "Elastic Search",  
"\_attachments": {  
"exam.docx": {  
"content\_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",  
"revpos": 4,  
"digest": "md5-ecdBcsbc6w7mC1EOgd5SIg==",  
"length": 10007,  
"stub": true  
},  
"2230681.pdf": {  
"content\_type": "application/pdf",  
"revpos": 2,  
"digest": "md5-BUhqhHiVqKybxrfGsQTixQ==",  
"length": 956146,  
"stub": true  
}  
}  
}  
{  
"\_id": "Doc2",  
"\_rev": "7-dd58025abc2002566b6f458ad3d83d4d",  
"message": test attachments",  
"\_attachments": {  
"TestAttachments.txt": {  
"content\_type": "text/plain",  
"revpos": 6,  
"digest": "md5-aLTD+adMRHPw2+WMIN/42Q==",  
"length": 89,  
"stub": true  
},  
"DynamicPublishingUseCases.doc": {  
"content\_type": "application/msword",  
"revpos": 2,  
"digest": "md5-FRdhydLr57C+q3ff6xLEmA==",  
"length": 22528,  
"stub": true  
}  
}  
}

Here is my test with elastic search:  
curl -X PUT "localhost:9200/test\_idx\_couchdb\_attachments"  
{"ok":true,"acknowledged":true}

curl -XPUT '[http://localhost:9200/\_river/test\_river\_couchdb\_attachments/\_meta](http://localhost:9200/_river/test_river_couchdb_attachments/_meta)' -d '{"type" : "couchdb", "couchdb" : {"host" : "localhost","port" : 5984,"db" : "my\_test\_couchdb\_attachments","filter" : null,"ignore\_attachments":false}},"index" : {"index" : "test\_idx\_couchdb\_attachments", "type" : "test\_mapping\_couchdb\_attachments" } }'  
{"ok":true,"\_index":"\_river","\_type":"test\_river\_couchdb\_attachments","\_id":"\_meta","\_version":1}  
At first, I type:  
curl -X PUT [http://127.0.0.1:9200/my\_test\_couchdb\_attachments/my\_test\_couchdb\_attachments/\_mapping](http://127.0.0.1:9200/my_test_couchdb_attachments/my_test_couchdb_attachments/_mapping) -d '{  
"my\_test\_couchdb\_attachments": {  
"properties": {  
"\_attachments": {  
"properties": {  
"2230681.pdf": {  
"type": "attachment", "index" : "analyzed"  
},  
"DynamicPublishingUseCases.doc": {  
"type": "attachment", "index" : "analyzed"  
},  
"TestAttachments.txt": {  
"type": "attachment", "index" : "analyzed"  
},  
"exam.docx": {  
"type": "attachment", "index" : "analyzed"  
}  
}  
},  
"message" : {  
"type": "string", "index" : "analyzed"  
}  
}  
}  
}'  
and I receive results:  
{"error":"MergeMappingException[Merge failed with failures {[Can't merge a non object mapping [TestAttachments.txt] with an object mapping [TestAttachments.txt], Can't merge a non object mapping [2230681.pdf] with an object mapping [2230681.pdf], Can't merge a non object mapping [exam.docx] with an object mapping [exam.docx], Can't merge a non object mapping [DynamicPublishingUseCases.doc] with an object mapping [DynamicPublishingUseCases.doc]]}]  
So I change and I succeed:  
curl -X PUT [http://127.0.0.1:9200/my\_test\_couchdb\_attachments/my\_test\_couchdb\_attachments/\_mapping](http://127.0.0.1:9200/my_test_couchdb_attachments/my_test_couchdb_attachments/_mapping) -d '{  
"my\_test\_couchdb\_attachments": {  
"properties": {  
"\_attachments": {  
"properties": {  
""2230681.pdf"": {  
"type": "attachment", "index" : "analyzed"  
},  
""DynamicPublishingUseCases.doc"": {  
"type": "attachment", "index" : "analyzed"  
},  
""TestAttachments.txt"": {  
"type": "attachment", "index" : "analyzed"  
},  
""exam.docx"": {  
"type": "attachment", "index" : "analyzed"  
}  
}  
},  
"message" : {  
"type": "string", "index" : "analyzed"  
}  
}  
}  
}'  
{"ok":true,"acknowledged":true}

curl -XPOST '[http://localhost:9200/my\_test\_couchdb\_attachments/my\_test\_couchdb\_attachments/\_search?pretty=true](http://localhost:9200/my_test_couchdb_attachments/my_test_couchdb_attachments/_search?pretty=true)' -d '{"query" : {"wildcard" : { "\_all" : "\*" } } }'  
This query works well by returning two documents  
these queries donot work well with errors or no expected results:curl -XGET '[http://localhost:9200/my\_test\_couchdb\_attachments/my\_test\_couchdb\_attachments/\_search](http://localhost:9200/my_test_couchdb_attachments/my_test_couchdb_attachments/_search)' -d '{"query" : {"text" : { "\_attachments."2230681.pdf".content" : "Temperature" } } }'{"took":0,"timed\_out":false,"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max\_score":null,"hits":[]}}curl -XGET '[http://localhost:9200/my\_test\_couchdb\_attachments/my\_test\_couchdb\_attachments/\_search](http://localhost:9200/my_test_couchdb_attachments/my_test_couchdb_attachments/_search)' -d '{"query" : {"text" : { "\_attachments.[2230681.pdf] : "Temperature" } } }'{"error":"SearchPhaseExecutionException[Failed to execute phase [query], total failure; shardFailures {[CHYAFYCERMGHlBvKHiEagA][my\_test\_couchdb\_attachments][3]: SearchParseException[[my\_test\_couchdb\_attachments][3]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query" : {"text" : { "\_attachments.[2230681.pdf] : "Temperature" } } }]]]; nested:  
QueryParsingException[[my\_test\_couchdb\_attachments] Failed to parse]; nested: JsonParseException[Unexpected character ('T' (code 84)): was expecting a colon to separate field name and value\n at [Source: [B@582a85; line: 1, column: 56]]; }]curl -XPOST '[http://localhost:9200/my\_test\_couchdb\_attachments/my\_test\_couchdb\_attachments/\_search?pretty=true](http://localhost:9200/my_test_couchdb_attachments/my_test_couchdb_attachments/_search?pretty=true)' -d '{"query" : {"text" : { "\_attachments."DynamicPublishingUseCases.doc"" : "Rendering" } } }'{ "took" : 0, "timed\_out" : false, "\_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 0, "max\_score" : null, "hits" : [] }}curl -XPOST '[http://localhost:9200/my\_test\_couchdb\_attachments/my\_test\_couchdb\_attachments/\_search?pretty=true](http://localhost:9200/my_test_couchdb_attachments/my_test_couchdb_attachments/_search?pretty=true)' -d '{"query" : {"text\_phrase" : { "\_attachments."TestAttachments.txt"" : "Couchdb" } } }'{ "took" : 0, "timed\_out" : false, "\_shards" : { "total" : 5, "successful" : 5, "failed"  
: 0 }, "hits" : { "total" : 0, "max\_score" : null, "hits" : [] }}I have used Elastic search 0.18.4 with river Couchdb 1.1.0 and mapper-attachments plugins 1.1.0Please explain to me and how to index couchdb attachments and make it searchable?Maybe I should submit the pdf files whose content is encoded with base64? All my files in my test arenot encoded.Thanks a lot

* * *

* * *

De : David Pilato [david@pilato.fr](mailto:david@pilato.fr)  
À : elasticsearch [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
Envoyé le : Mercredi 28 Décembre 2011 14h12  
Objet : Re: how to create index for a attachment of a doc in couchDB with ES?  
Did anyone test it ?BTW, I updated the README file :[https://github.com/dadoonet/elasticsearch-river-couchdb/blob/attachments/README.mdPlease](https://github.com/dadoonet/elasticsearch-river-couchdb/blob/attachments/README.mdPlease) let me know (CouchDB river users) if there is any regression orif I can submit the pull request.Thanks,David.On 22 déc, 00:11, "David Pilato" [da...@pilato.fr](mailto:da...@pilato.fr) wrote:\> Hi there,\>\> I just finished something to deal with couchDb attachments using elasticsearch-mapper-attachments.\>\> Before going further, is it possible for you to fork my code [1], compile it and launch the main test class CouchdbRiverBinaryAttachementTest and send some docs with one or more attachments and see if you can search for it ?\>\> I tried with a very simple PDF file and it seems to work fine.\>\> I start to write a little documentation about it [2] (see at the end).\>\> You can also download the plugin [3] and install it instead of the previous couchDb plugin.\>\> BTW, you should have installed before the elasticsearch-mapper-attachments plugin  
[4].\>\> Please let me know if it’s working or not for you.\>\> Cheers,\>\> David.\>\> [1][https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments](https://github.com/dadoonet/elasticsearch-river-couchdb/tree/attachments)\> [2][https://github.com/dadoonet/elasticsearch.github.com/blob/b77ebec4e44](https://github.com/dadoonet/elasticsearch.github.com/blob/b77ebec4e44)...\> [3][https://github.com/downloads/dadoonet/elasticsearch-river-couchdb/ela](https://github.com/downloads/dadoonet/elasticsearch-river-couchdb/ela)...\> [4][https://github.com/elasticsearch/elasticsearch-mapper-attachments](https://github.com/elasticsearch/elasticsearch-mapper-attachments)

[Next page](https://discuss.elastic.co/t/how-to-create-index-for-a-attachment-of-a-doc-in-couchdb-with-es/6026.md?page=2)
