Highlight using _source in Elasticsearch0.14.0 version


(senthil prabhu) #1

Hi,
I want to know how to highlight in elastic search version
0.14.0. Here I am indexing a file with below mapping query.

Mapping query:{"metadata" : {"dynamic" :"true","_source" :
{"enabled" :true },"properties" : { } } }

and i am search here using the below query

Search query:{"query" : { "query_string" : { "default_field" : "",
"query" : "title:tiff0003","default_operator" : "OR","analyzer" :
"standard","allow_leading_wildcard" :
true,"lowercase_expanded_terms" : true,"enable_position_increments" :
true,"fuzzy_prefix_length" : 0,"fuzzy_min_sim" : 0.5,"phrase_slop" :
0,"boost" : 1.0 } }, "from" : 0, "size" : 20, "highlight" :
{ "tags_schema" : "styled" ,"pre_tags" : [ ""] ,"post_tags" :
[ "
" ] ,"fields" : { "title" : {"fragment_size" :
1500,"number_of_fragments" : 10 } } }, "explain" : false,"fields" :
["title" ] }.

search output gets one document without highlighting.Is any thing
wrong in my queries. can anyone explain how to get highlight using
_source field.


(Shay Banon) #2

You still need to have the term_vector mapping set on the title field to
"with_positions_offsets".

On Wed, Dec 29, 2010 at 7:16 AM, senthil prabhu senthilsebi@gmail.comwrote:

Hi,
I want to know how to highlight in elastic search version
0.14.0. Here I am indexing a file with below mapping query.

Mapping query:{"metadata" : {"dynamic" :"true","_source" :
{"enabled" :true },"properties" : { } } }

and i am search here using the below query

Search query:{"query" : { "query_string" : { "default_field" : "",
"query" : "title:tiff0003","default_operator" : "OR","analyzer" :
"standard","allow_leading_wildcard" :
true,"lowercase_expanded_terms" : true,"enable_position_increments" :
true,"fuzzy_prefix_length" : 0,"fuzzy_min_sim" : 0.5,"phrase_slop" :
0,"boost" : 1.0 } }, "from" : 0, "size" : 20, "highlight" :
{ "tags_schema" : "styled" ,"pre_tags" : [ ""] ,"post_tags" :
[ "
" ] ,"fields" : { "title" : {"fragment_size" :
1500,"number_of_fragments" : 10 } } }, "explain" : false,"fields" :
["title" ] }.

search output gets one document without highlighting.Is any thing
wrong in my queries. can anyone explain how to get highlight using
_source field.


(senthil prabhu) #3

So you said each and every field should be mapped am i right?

Another doubt here is do i need to create an index with analyzed and
stored? Why i am asking here is Elastic search 0.14.0 release notes
shows that by using _source itself we can highlight...

On Dec 29, 1:53 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

You still need to have the term_vector mapping set on the title field to
"with_positions_offsets".

On Wed, Dec 29, 2010 at 7:16 AM, senthil prabhu senthils...@gmail.comwrote:

Hi,
I want to know how to highlight in elastic search version
0.14.0. Here I am indexing a file with below mapping query.

Mapping query:{"metadata" : {"dynamic" :"true","_source" :
{"enabled" :true },"properties" : { } } }

and i am search here using the below query

Search query:{"query" : { "query_string" : { "default_field" : "",
"query" : "title:tiff0003","default_operator" : "OR","analyzer" :
"standard","allow_leading_wildcard" :
true,"lowercase_expanded_terms" : true,"enable_position_increments" :
true,"fuzzy_prefix_length" : 0,"fuzzy_min_sim" : 0.5,"phrase_slop" :
0,"boost" : 1.0 } }, "from" : 0, "size" : 20, "highlight" :
{ "tags_schema" : "styled" ,"pre_tags" : [ ""] ,"post_tags" :
[ "
" ] ,"fields" : { "title" : {"fragment_size" :
1500,"number_of_fragments" : 10 } } }, "explain" : false,"fields" :
["title" ] }.

search output gets one document without highlighting.Is any thing
wrong in my queries. can anyone explain how to get highlight using
_source field.


(Shay Banon) #4

You don't need to have the field stored, but it needs to have the
term_vector set.
http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/highlighting/
.

On Wed, Dec 29, 2010 at 11:31 AM, senthil prabhu senthilsebi@gmail.comwrote:

So you said each and every field should be mapped am i right?

Another doubt here is do i need to create an index with analyzed and
stored? Why i am asking here is Elastic search 0.14.0 release notes
shows that by using _source itself we can highlight...

On Dec 29, 1:53 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

You still need to have the term_vector mapping set on the title field to
"with_positions_offsets".

On Wed, Dec 29, 2010 at 7:16 AM, senthil prabhu <senthils...@gmail.com
wrote:

Hi,
I want to know how to highlight in elastic search version
0.14.0. Here I am indexing a file with below mapping query.

Mapping query:{"metadata" : {"dynamic" :"true","_source" :
{"enabled" :true },"properties" : { } } }

and i am search here using the below query

Search query:{"query" : { "query_string" : { "default_field" : "",
"query" : "title:tiff0003","default_operator" : "OR","analyzer" :
"standard","allow_leading_wildcard" :
true,"lowercase_expanded_terms" : true,"enable_position_increments" :
true,"fuzzy_prefix_length" : 0,"fuzzy_min_sim" : 0.5,"phrase_slop" :
0,"boost" : 1.0 } }, "from" : 0, "size" : 20, "highlight" :
{ "tags_schema" : "styled" ,"pre_tags" : [ ""] ,"post_tags" :
[ "
" ] ,"fields" : { "title" : {"fragment_size" :
1500,"number_of_fragments" : 10 } } }, "explain" : false,"fields" :
["title" ] }.

search output gets one document without highlighting.Is any thing
wrong in my queries. can anyone explain how to get highlight using
_source field.


(senthil prabhu) #5

Thank you shay banon

On Dec 29, 3:16 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

You don't need to have the field stored, but it needs to have the
term_vector set.http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/highl...
.

On Wed, Dec 29, 2010 at 11:31 AM, senthil prabhu senthils...@gmail.comwrote:

So you said each and every field should be mapped am i right?

Another doubt here is do i need to create an index with analyzed and
stored? Why i am asking here is Elastic search 0.14.0 release notes
shows that by using _source itself we can highlight...

On Dec 29, 1:53 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

You still need to have the term_vector mapping set on the title field to
"with_positions_offsets".

On Wed, Dec 29, 2010 at 7:16 AM, senthil prabhu <senthils...@gmail.com
wrote:

Hi,
I want to know how to highlight in elastic search version
0.14.0. Here I am indexing a file with below mapping query.

Mapping query:{"metadata" : {"dynamic" :"true","_source" :
{"enabled" :true },"properties" : { } } }

and i am search here using the below query

Search query:{"query" : { "query_string" : { "default_field" : "",
"query" : "title:tiff0003","default_operator" : "OR","analyzer" :
"standard","allow_leading_wildcard" :
true,"lowercase_expanded_terms" : true,"enable_position_increments" :
true,"fuzzy_prefix_length" : 0,"fuzzy_min_sim" : 0.5,"phrase_slop" :
0,"boost" : 1.0 } }, "from" : 0, "size" : 20, "highlight" :
{ "tags_schema" : "styled" ,"pre_tags" : [ ""] ,"post_tags" :
[ "
" ] ,"fields" : { "title" : {"fragment_size" :
1500,"number_of_fragments" : 10 } } }, "explain" : false,"fields" :
["title" ] }.

search output gets one document without highlighting.Is any thing
wrong in my queries. can anyone explain how to get highlight using
_source field.


(system) #6