Eyal
(Eyal)
August 6, 2013, 9:53am
1
I'm trying to get the attachment feature working but I have some problems
posting the attachment.
I'm using elasticsearch-0.90.1, mapper-attachments (from the loading
comments:
[2013-08-06 12:23:00,040][INFO ][plugins ] [Franz Kafka -
Node 1 - Client] loaded [mapper-attachments], sites [bigdesk, head,
paramedic])
I have a field of type 'attachment' named 'my_attachment', and I'm trying
to post a file to it like so:
curl -X POST
"http://localhost:9200/system_attachments/system%2Fattachment/2 " -d
'{"my_attachment":"TG9yZW0gSXBzdW0gaXMgc2ltcGx5IGR1bW15IHRleHQgb2YgdGhlIHByaW50\naW5nIGFuZCB0eXBlc2V0dGluZyBpbmR1c3RyeS4gTG9yZW0gSXBzdW0gaGFz\nIGJlZW4gdGhlIGluZHVzdHJ5J3Mgc3RhbmRhcmQgZHVtbXkgdGV4dCBldmVy\nIHNpbmNlIHRoZSAxNTAwcywgd2hlbiBhbiB1bmtub3duIHByaW50ZXIgdG9v\nayBhIGdhbGxleSBvZiB0eXBlIGFuZCBzY3JhbWJsZWQgaXQgdG8gbWFrZSBh\nIHR5cGUgc3BlY2ltZW4gYm9vay4gSXQgaGFzIHN1cnZpdmVkIG5vdCBvbmx5\nIGZpdmUgY2VudHVyaWVzLCBidXQgYWxzbyB0aGUgbGVhcCBpbnRvIGVsZWN0\ncm9uaWMgdHlwZXNldHRpbmcsIHJlbWFpbmluZyBlc3NlbnRpYWxseSB1bmNo\nYW5nZWQuIEl0IHdhcyBwb3B1bGFyaXNlZCBpbiB0aGUgMTk2MHMgd2l0aCB0\naGUgcmVsZWFzZSBvZiBMZXRyYXNldCBzaGVldHMgY29udGFpbmluZyBMb3Jl\nbSBJcHN1bSBwYXNzYWdlcywgYW5kIG1vcmUgcmVjZW50bHkgd2l0aCBkZXNr\ndG9wIHB1Ymxpc2hpbmcgc29mdHdhcmUgbGlrZSBBbGR1cyBQYWdlTWFrZXIg\naW5jbHVkaW5nIHZlcnNpb25zIG9mIExvcmVtIElwc3VtLg==\n"}'
My mapping looks ok, you can see that 'my_attachment' is of type
'attachment' and all the default fields. This is my mapping:
{
state: open
settings: {
index.analysis.filter.my_ngram.max_gram: 15
index.analysis.filter.my_ngram.type: nGram
index.number_of_replicas: 0
index.analysis.filter.my_ngram.min_gram: 1
index.analysis.analyzer.ngram_analyzer.filter.1: my_ngram
index.analysis.filter.my_stemmer.name: english
index.analysis.analyzer.ngram_analyzer.filter.0: stop
index.analysis.filter.my_stemmer.type: stemmer
index.analysis.analyzer.ngram_analyzer.tokenizer: whitespace
index.analysis.analyzer.ngram_analyzer.type: custom
index.number_of_shards: 2
index.analysis.analyzer.ngram_analyzer.filter.2: lowercase
index.version.created: 900199
}
mappings: {
system/attachment: {
properties: {
my_attachment: {
path: full
type: attachment
fields: {
author: {
type: string
}
title: {
type: string
}
keywords: {
type: string
}
my_attachment: {
analyzer: ngram_analyzer
type: string
}
name: {
type: string
}
date: {
format: dateOptionalTime
type: date
}
content_type: {
type: string
}
}
}
description: {
analyzer: ngram_analyzer
type: string
}
attachment_file_name: {
analyzer: ngram_analyzer
type: string
}
filename: {
analyzer: ngram_analyzer
type: string
}
}
}
}
aliases: [ ]
}
but the document is looking strange:
{
_index: system_attachments
_type: system/attachment
_id: 2
_version: 2
_score: 1
_source: {
my_attachment: TG9yZW0gSXBzdW0gaXMgc2ltcGx5IGR1bW15IHRleHQgb2YgdGhlIHByaW50
aW5nIGFuZCB0eXBlc2V0dGluZyBpbmR1c3RyeS4gTG9yZW0gSXBzdW0gaGFz
IGJlZW4gdGhlIGluZHVzdHJ5J3Mgc3RhbmRhcmQgZHVtbXkgdGV4dCBldmVy
IHNpbmNlIHRoZSAxNTAwcywgd2hlbiBhbiB1bmtub3duIHByaW50ZXIgdG9v
ayBhIGdhbGxleSBvZiB0eXBlIGFuZCBzY3JhbWJsZWQgaXQgdG8gbWFrZSBh
IHR5cGUgc3BlY2ltZW4gYm9vay4gSXQgaGFzIHN1cnZpdmVkIG5vdCBvbmx5
IGZpdmUgY2VudHVyaWVzLCBidXQgYWxzbyB0aGUgbGVhcCBpbnRvIGVsZWN0
cm9uaWMgdHlwZXNldHRpbmcsIHJlbWFpbmluZyBlc3NlbnRpYWxseSB1bmNo
YW5nZWQuIEl0IHdhcyBwb3B1bGFyaXNlZCBpbiB0aGUgMTk2MHMgd2l0aCB0
aGUgcmVsZWFzZSBvZiBMZXRyYXNldCBzaGVldHMgY29udGFpbmluZyBMb3Jl
bSBJcHN1bSBwYXNzYWdlcywgYW5kIG1vcmUgcmVjZW50bHkgd2l0aCBkZXNr
dG9wIHB1Ymxpc2hpbmcgc29mdHdhcmUgbGlrZSBBbGR1cyBQYWdlTWFrZXIg
aW5jbHVkaW5nIHZlcnNpb25zIG9mIExvcmVtIElwc3VtLg==
}
}
What am I doing wrong?
Cheers,
Eyal.
--
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 .
For more options, visit https://groups.google.com/groups/opt_out .
Eyal
(Eyal)
August 6, 2013, 10:50am
2
I can't search for the content in these files, whether its pdf or xlsx.
However, searching in txt files does work..
On Tuesday, August 6, 2013 12:53:36 PM UTC+3, Eyal wrote:
I'm trying to get the attachment feature working but I have some problems
posting the attachment.
I'm using elasticsearch-0.90.1, mapper-attachments (from the loading
comments:
[2013-08-06 12:23:00,040][INFO ][plugins ] [Franz Kafka -
Node 1 - Client] loaded [mapper-attachments], sites [bigdesk, head,
paramedic])
I have a field of type 'attachment' named 'my_attachment', and I'm trying
to post a file to it like so:
curl -X POST "
http://localhost:9200/system_attachments/system%2Fattachment/2 " -d
'{"my_attachment":"TG9yZW0gSXBzdW0gaXMgc2ltcGx5IGR1bW15IHRleHQgb2YgdGhlIHByaW50\naW5nIGFuZCB0eXBlc2V0dGluZyBpbmR1c3RyeS4gTG9yZW0gSXBzdW0gaGFz\nIGJlZW4gdGhlIGluZHVzdHJ5J3Mgc3RhbmRhcmQgZHVtbXkgdGV4dCBldmVy\nIHNpbmNlIHRoZSAxNTAwcywgd2hlbiBhbiB1bmtub3duIHByaW50ZXIgdG9v\nayBhIGdhbGxleSBvZiB0eXBlIGFuZCBzY3JhbWJsZWQgaXQgdG8gbWFrZSBh\nIHR5cGUgc3BlY2ltZW4gYm9vay4gSXQgaGFzIHN1cnZpdmVkIG5vdCBvbmx5\nIGZpdmUgY2VudHVyaWVzLCBidXQgYWxzbyB0aGUgbGVhcCBpbnRvIGVsZWN0\ncm9uaWMgdHlwZXNldHRpbmcsIHJlbWFpbmluZyBlc3NlbnRpYWxseSB1bmNo\nYW5nZWQuIEl0IHdhcyBwb3B1bGFyaXNlZCBpbiB0aGUgMTk2MHMgd2l0aCB0\naGUgcmVsZWFzZSBvZiBMZXRyYXNldCBzaGVldHMgY29udGFpbmluZyBMb3Jl\nbSBJcHN1bSBwYXNzYWdlcywgYW5kIG1vcmUgcmVjZW50bHkgd2l0aCBkZXNr\ndG9wIHB1Ymxpc2hpbmcgc29mdHdhcmUgbGlrZSBBbGR1cyBQYWdlTWFrZXIg\naW5jbHVkaW5nIHZlcnNpb25zIG9mIExvcmVtIElwc3VtLg==\n"}'
My mapping looks ok, you can see that 'my_attachment' is of type
'attachment' and all the default fields. This is my mapping:
{
state: open
settings: {
index.analysis.filter.my_ngram.max_gram: 15
index.analysis.filter.my_ngram.type: nGram
index.number_of_replicas: 0
index.analysis.filter.my_ngram.min_gram: 1
index.analysis.analyzer.ngram_analyzer.filter.1: my_ngram
index.analysis.filter.my_stemmer.name: english
index.analysis.analyzer.ngram_analyzer.filter.0: stop
index.analysis.filter.my_stemmer.type: stemmer
index.analysis.analyzer.ngram_analyzer.tokenizer: whitespace
index.analysis.analyzer.ngram_analyzer.type: custom
index.number_of_shards: 2
index.analysis.analyzer.ngram_analyzer.filter.2: lowercase
index.version.created: 900199
}
mappings: {
system/attachment: {
properties: {
my_attachment: {
path: full
type: attachment
fields: {
author: {
type: string
}
title: {
type: string
}
keywords: {
type: string
}
my_attachment: {
analyzer: ngram_analyzer
type: string
}
name: {
type: string
}
date: {
format: dateOptionalTime
type: date
}
content_type: {
type: string
}
}
}
description: {
analyzer: ngram_analyzer
type: string
}
attachment_file_name: {
analyzer: ngram_analyzer
type: string
}
filename: {
analyzer: ngram_analyzer
type: string
}
}
}
}
aliases:
}
but the document is looking strange:
{
_index: system_attachments
_type: system/attachment
_id: 2
_version: 2
_score: 1
_source: {
my_attachment:
TG9yZW0gSXBzdW0gaXMgc2ltcGx5IGR1bW15IHRleHQgb2YgdGhlIHByaW50
aW5nIGFuZCB0eXBlc2V0dGluZyBpbmR1c3RyeS4gTG9yZW0gSXBzdW0gaGFz
IGJlZW4gdGhlIGluZHVzdHJ5J3Mgc3RhbmRhcmQgZHVtbXkgdGV4dCBldmVy
IHNpbmNlIHRoZSAxNTAwcywgd2hlbiBhbiB1bmtub3duIHByaW50ZXIgdG9v
ayBhIGdhbGxleSBvZiB0eXBlIGFuZCBzY3JhbWJsZWQgaXQgdG8gbWFrZSBh
IHR5cGUgc3BlY2ltZW4gYm9vay4gSXQgaGFzIHN1cnZpdmVkIG5vdCBvbmx5
IGZpdmUgY2VudHVyaWVzLCBidXQgYWxzbyB0aGUgbGVhcCBpbnRvIGVsZWN0
cm9uaWMgdHlwZXNldHRpbmcsIHJlbWFpbmluZyBlc3NlbnRpYWxseSB1bmNo
YW5nZWQuIEl0IHdhcyBwb3B1bGFyaXNlZCBpbiB0aGUgMTk2MHMgd2l0aCB0
aGUgcmVsZWFzZSBvZiBMZXRyYXNldCBzaGVldHMgY29udGFpbmluZyBMb3Jl
bSBJcHN1bSBwYXNzYWdlcywgYW5kIG1vcmUgcmVjZW50bHkgd2l0aCBkZXNr
dG9wIHB1Ymxpc2hpbmcgc29mdHdhcmUgbGlrZSBBbGR1cyBQYWdlTWFrZXIg
aW5jbHVkaW5nIHZlcnNpb25zIG9mIExvcmVtIElwc3VtLg==
}
}
What am I doing wrong?
Cheers,
Eyal.
--
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 .
For more options, visit https://groups.google.com/groups/opt_out .