Rg: attachment highlighting


(Bhavani Krishna) #1

hi, i create a index like below

curl -XPUT 'http://localhost:9200/testindex11/' -d '{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 0
}
}
}'

and i mapped it like below

curl -XPUT localhost:9200/testindex11/testmap/_mapping -d '
{
"testmap": {
"properties" : {
"files" : { "type" : "attachment",
"content" : { "term_vector":"with_positions_offsets","store":"yes" } }
}
}
}
'

and i stored the data like below

curl -XPUT localhost:9200/testindex11/testmap/1 -d '
{
"files" : [
{
"_content_type" : "application/pdf",
"_name" : "/home/fstl/Documents/200302L045.pdf",
"content" : "BASE64 ENCODED STRING OF PDF/XML/...."
}
]
}'

and i searched like below

curl -XGET 'http://localhost:9200/testindex11/_search?pretty=true' -d
'
{
"query" : {
"term" : { "files": "bhavani" }
},"highlight" : {
"fields" : {
"files" : { "content" : {} }
}
}
}'

but i am not getting the highlighted results, just getting content in
base64 format.

so what i can do to get the results along with highlighted results?


(Lukáš Vlček) #2

Hi,

Here you can find complete attachment example


Now with highlighting too.

HTH,

Regards,
Lukas

On Tue, Jul 12, 2011 at 3:44 PM, Bhavani Krishna kbkrishnacse@gmail.comwrote:

hi, i create a index like below

curl -XPUT 'http://localhost:9200/testindex11/' -d '{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 0
}
}
}'

and i mapped it like below

curl -XPUT localhost:9200/testindex11/testmap/_mapping -d '
{
"testmap": {
"properties" : {
"files" : { "type" : "attachment",
"content" : { "term_vector":"with_positions_offsets","store":"yes" } }
}
}
}
'

and i stored the data like below

curl -XPUT localhost:9200/testindex11/testmap/1 -d '
{
"files" : [
{
"_content_type" : "application/pdf",
"_name" : "/home/fstl/Documents/200302L045.pdf",
"content" : "BASE64 ENCODED STRING OF PDF/XML/...."
}
]
}'

and i searched like below

curl -XGET 'http://localhost:9200/testindex11/_search?pretty=true' -d
'
{
"query" : {
"term" : { "files": "bhavani" }
},"highlight" : {
"fields" : {
"files" : { "content" : {} }
}
}
}'

but i am not getting the highlighted results, just getting content in
base64 format.

so what i can do to get the results along with highlighted results?


(David Pilato) #3

Great !

I suggest creating a pull request to add an example chapter (or a Faq) to share it with the whole ES community.

Is there any place in the site where it can be put (tutorial ?)

David :wink:

Le 12 juil. 2011 à 16:52, Lukáš Vlček lukas.vlcek@gmail.com a écrit :

Hi,

Here you can find complete attachment example https://gist.github.com/1075067
Now with highlighting too.

HTH,

Regards,
Lukas

On Tue, Jul 12, 2011 at 3:44 PM, Bhavani Krishna kbkrishnacse@gmail.com wrote:
hi, i create a index like below

curl -XPUT 'http://localhost:9200/testindex11/' -d '{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 0
}
}
}'

and i mapped it like below

curl -XPUT localhost:9200/testindex11/testmap/_mapping -d '
{
"testmap": {
"properties" : {
"files" : { "type" : "attachment",
"content" : { "term_vector":"with_positions_offsets","store":"yes" } }
}
}
}
'

and i stored the data like below

curl -XPUT localhost:9200/testindex11/testmap/1 -d '
{
"files" : [
{
"_content_type" : "application/pdf",
"_name" : "/home/fstl/Documents/200302L045.pdf",
"content" : "BASE64 ENCODED STRING OF PDF/XML/...."
}
]
}'

and i searched like below

curl -XGET 'http://localhost:9200/testindex11/_search?pretty=true' -d
'
{
"query" : {
"term" : { "files": "bhavani" }
},"highlight" : {
"fields" : {
"files" : { "content" : {} }
}
}
}'

but i am not getting the highlighted results, just getting content in
base64 format.

so what i can do to get the results along with highlighted results?


(Lukáš Vlček) #4

Yea, may be a tiny tutorial page about attachments would be nice.

Lukas

On Tue, Jul 12, 2011 at 5:04 PM, David Pilato david@pilato.fr wrote:

Great !

I suggest creating a pull request to add an example chapter (or a Faq) to
share it with the whole ES community.

Is there any place in the site where it can be put (tutorial ?)

David :wink:

Le 12 juil. 2011 à 16:52, Lukáš Vlček lukas.vlcek@gmail.com a écrit :

Hi,

Here you can find complete attachment example https://gist.github.com/1075067
https://gist.github.com/1075067
Now with highlighting too.

HTH,

Regards,
Lukas

On Tue, Jul 12, 2011 at 3:44 PM, Bhavani Krishna <kbkrishnacse@gmail.com
kbkrishnacse@gmail.com> wrote:

hi, i create a index like below

curl -XPUT ' http://localhost:9200/testindex11/
http://localhost:9200/testindex11/' -d '{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 0
}
}
}'

and i mapped it like below

curl -XPUT localhost:9200/testindex11/testmap/_mapping -d '
{
"testmap": {
"properties" : {
"files" : { "type" : "attachment",
"content" : { "term_vector":"with_positions_offsets","store":"yes" } }
}
}
}
'

and i stored the data like below

curl -XPUT localhost:9200/testindex11/testmap/1 -d '
{
"files" : [
{
"_content_type" : "application/pdf",
"_name" : "/home/fstl/Documents/200302L045.pdf",
"content" : "BASE64 ENCODED STRING OF PDF/XML/...."
}
]
}'

and i searched like below

curl -XGET ' http://localhost:9200/testindex11/_search?pretty=true
http://localhost:9200/testindex11/_search?pretty=true' -d
'
{
"query" : {
"term" : { "files": "bhavani" }
},"highlight" : {
"fields" : {
"files" : { "content" : {} }
}
}
}'

but i am not getting the highlighted results, just getting content in
base64 format.

so what i can do to get the results along with highlighted results?


(Bhavani Krishna) #5

Thanks..it solved my problem

On Jul 12, 7:52 pm, Lukáš Vlček lukas.vl...@gmail.com wrote:

Hi,

Here you can find complete attachment examplehttps://gist.github.com/1075067
Now with highlighting too.

HTH,

Regards,
Lukas

On Tue, Jul 12, 2011 at 3:44 PM, Bhavani Krishna kbkrishna...@gmail.comwrote:

hi, i create a index like below

curl -XPUT 'http://localhost:9200/testindex11/'-d '{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 0
}
}
}'

and i mapped it like below

curl -XPUT localhost:9200/testindex11/testmap/_mapping -d '
{
"testmap": {
"properties" : {
"files" : { "type" : "attachment",
"content" : { "term_vector":"with_positions_offsets","store":"yes" } }
}
}
}
'

and i stored the data like below

curl -XPUT localhost:9200/testindex11/testmap/1 -d '
{
"files" : [
{
"_content_type" : "application/pdf",
"_name" : "/home/fstl/Documents/200302L045.pdf",
"content" : "BASE64 ENCODED STRING OF PDF/XML/...."
}
]
}'

and i searched like below

curl -XGET 'http://localhost:9200/testindex11/_search?pretty=true'-d
'
{
"query" : {
"term" : { "files": "bhavani" }
},"highlight" : {
"fields" : {
"files" : { "content" : {} }
}
}
}'

but i am not getting the highlighted results, just getting content in
base64 format.

so what i can do to get the results along with highlighted results?


(system) #6