Changing the mapping to store the actual content, then use fields option in 
search to get content field back.

--
David ;-)
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

> Le 7 nov. 2014 à 15:00, Jim Cumming <[email protected]> a écrit :
> 
> Thanks David, is there any easy way to view the parsed data other than 
> searching?
> 
>> On Friday, 7 November 2014 13:55:41 UTC, David Pilato wrote:
>> Attachment plugin index binary content but does not actually modify the 
>> source document (_source field).
>> 
>> But if you _search for content it should work.
>> 
>> --
>> David ;-)
>> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
>> 
>> Le 7 nov. 2014 à 14:44, Jim Cumming <[email protected]> a écrit :
>> 
>> Hi. I'm quite new to elasticsearch, so far it's all been going great but 
>> I've run into a wall and after a few days of no progress I thought it was 
>> time to ask for help. 
>> 
>> I'm trying to create a replacement search solution for a CMS system, one of 
>> the requirements is that it needs to index binary files. The 
>> mapping-attachments plugin appears to be just the thing, but I'm struggling 
>> to get it to work. 
>> 
>> I've tried this with ElasticSearch 1.3x and Mapper Attachements 2.3.2 and 
>> ElasticSearch 1.4x and Mapper Attachments 2.4.2 running under Windows. I 
>> have no errors in the log, the plugin appears to be loading correctly, so I 
>> assume I'm doing something wrong with my requests.
>> 
>> I've simplified my requests down to the most basic level I can, and the 
>> issue still occurs. Testing has been done with  the Postman extension in 
>> Chrome. But I've converted my posts to curl requests to help anyone who 
>> might want to try this on Linux. The Base64 file is a .txt file with some 
>> English text from the BBC News site. 
>> 
>> 
>> Create test index
>> curl -XPUT 'http://localhost:9200/test/'
>> 
>> 
>> Response
>> {
>>     "acknowledged": true
>> }
>> 
>> Create mapping for person
>> 
>> curl -XPUT 'http://localhost:9200/test/_mapping/person' -d '{
>>     "person" : {
>>         "properties" : {
>>             "my_attachment" : { "type" : "attachment" }
>>         }
>>     }
>> }'
>> 
>> 
>> Response
>> {
>>     "acknowledged": true
>> }
>> 
>> 
>> Get mapping for person
>> curl -XGET 'http://localhost:9200/test/_mapping/person'
>> 
>> Response
>> {
>>     "test": {
>>         "mappings": {
>>             "person": {
>>                 "properties": {
>>                     "my_attachment": {
>>                         "type": "attachment",
>>                         "path": "full",
>>                         "fields": {
>>                             "my_attachment": {
>>                                 "type": "string"
>>                             },
>>                             "author": {
>>                                 "type": "string"
>>                             },
>>                             "title": {
>>                                 "type": "string"
>>                             },
>>                             "name": {
>>                                 "type": "string"
>>                             },
>>                             "date": {
>>                                 "type": "date",
>>                                 "format": "dateOptionalTime"
>>                             },
>>                             "keywords": {
>>                                 "type": "string"
>>                             },
>>                             "content_type": {
>>                                 "type": "string"
>>                             },
>>                             "content_length": {
>>                                 "type": "integer"
>>                             },
>>                             "language": {
>>                                 "type": "string"
>>                             }
>>                         }
>>                     }
>>                 }
>>             }
>>         }
>>     }
>> }
>> 
>> This looks good, I have meta data fields for the file in the mapping
>> 
>> Create person id 1
>> 
>> curl -XPUT 'http://localhost:9200/test/person/1' -d '{
>>     "my_attachment" : 
>> "Rm9ybWVyIGNlbGVicml0eSBwdWJsaWNpc3QgTWF4IENsaWZmb3JkIGhhcyBoYWQgYW4gYXBwZWFsIGFnYWluc3QgaGlzIGVpZ2h0LXllYXIgc2VudGVuY2UgZm9yIHNleCBvZmZlbmNlcyByZWplY3RlZCBieSB0aGUgQ291cnQgb2YgQXBwZWFsLg0KDQpUaGUgY291cnQgcnVsZWQgdGhlIHNlbnRlbmNlIGhhbmRlZCB0byBDbGlmZm9yZCBlYXJsaWVyIHRoaXMgeWVhciB3YXMganVzdGlmaWVkIGFuZCBjb3JyZWN0Lg0KDQpDbGlmZm9yZCB3YXMgY29udmljdGVkIGluIEFwcmlsIG9mIGVpZ2h0IGhpc3RvcmljYWwgaW5kZWNlbnQgYXNzYXVsdHMgb24gd29tZW4gYW5kIG9uIGdpcmxzIGFzIHlvdW5nIGFzIDE1Lg0KDQpIaXMgbGF3eWVyIGhhZCBhcmd1ZWQgdGhlIHNlbnRlbmNlIHdhcyAidW5mYWlyIiBhbmQgY2xhaW1lZCBDbGlmZm9yZCB3YXMgbm90IGEgdGhyZWF0IHRvIHdvbWVuLg=="
>> }'
>> 
>> 
>> Response
>> {
>>     "_index": "test",
>>     "_type": "person",
>>     "_id": "1",
>>     "_version": 1,
>>     "created": true
>> }
>> 
>> Looks good, let's get that record back
>> 
>> Get person id 1
>> curl -XGET 'http://localhost:9200/test/person/1'
>> 
>> 
>> {
>>     "_index": "test",
>>     "_type": "person",
>>     "_id": "1",
>>     "_version": 1,
>>     "found": true,
>>     "_source": {
>>         "my_attachment": 
>> "Rm9ybWVyIGNlbGVicml0eSBwdWJsaWNpc3QgTWF4IENsaWZmb3JkIGhhcyBoYWQgYW4gYXBwZWFsIGFnYWluc3QgaGlzIGVpZ2h0LXllYXIgc2VudGVuY2UgZm9yIHNleCBvZmZlbmNlcyByZWplY3RlZCBieSB0aGUgQ291cnQgb2YgQXBwZWFsLg0KDQpUaGUgY291cnQgcnVsZWQgdGhlIHNlbnRlbmNlIGhhbmRlZCB0byBDbGlmZm9yZCBlYXJsaWVyIHRoaXMgeWVhciB3YXMganVzdGlmaWVkIGFuZCBjb3JyZWN0Lg0KDQpDbGlmZm9yZCB3YXMgY29udmljdGVkIGluIEFwcmlsIG9mIGVpZ2h0IGhpc3RvcmljYWwgaW5kZWNlbnQgYXNzYXVsdHMgb24gd29tZW4gYW5kIG9uIGdpcmxzIGFzIHlvdW5nIGFzIDE1Lg0KDQpIaXMgbGF3eWVyIGhhZCBhcmd1ZWQgdGhlIHNlbnRlbmNlIHdhcyAidW5mYWlyIiBhbmQgY2xhaW1lZCBDbGlmZm9yZCB3YXMgbm90IGEgdGhyZWF0IHRvIHdvbWVuLg=="
>>     }
>> }
>> 
>> Attachment has been added as a string, and there are no additional meta data 
>> fields
>> 
>> Here's my system info got via
>> 
>> curl -XGET 'http://localhost:9200/_nodes'
>> 
>> 
>> {
>>     "cluster_name": "elasticsearch",
>>     "nodes": {
>>         "QWhhRNIOTUWX_1OxGSJOvA": {
>>             "name": "Franz Kafka",
>>             "transport_address": "inet[/192.168.76.148:9300]",
>>             "host": "WIN-23CNBGGKSSE",
>>             "ip": "192.168.76.148",
>>             "version": "1.4.0",
>>             "build": "bc94bd8",
>>             "http_address": "inet[/192.168.76.148:9200]",
>>             "settings": {
>>                 "node": {
>>                     "name": "Franz Kafka"
>>                 },
>>                 "client": {
>>                     "type": "node"
>>                 },
>>                 "http": {
>>                     "cors": {
>>                         "enabled": "true",
>>                         "allow-origin": 
>> "/https?:\\/\\/local.kibana(:[0-9]+)?/"
>>                     }
>>                 },
>>                 "name": "Franz Kafka",
>>                 "path": {
>>                     "data"<span style="color: #660;" class="styled-by-pre
>> ...
> 
> -- 
> 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 [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/elasticsearch/7b929d77-26d1-4dbc-ae5d-158a8f660fcc%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/DBCF14F5-2FC9-4A67-BC37-1EC1440462FD%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.

Reply via email to