Highlighting only works if I put store : yes in the mapping


(fonzo14) #1

Hi all,

I'm an elasticsearch newbie.

I was playing with the highlight feature and i have been able to make
it work only if I set store:yes in the mapping. Otherwise it did not
work even with terms_vector : with_positions_offsets.

Reading the doc, I understand that if the field is not stored, it
would be retrieved from _source. Am I wrong or highlight should
normally work with the _source field ?

I'm on the last stable ES version

my mapping is quite simple :

{
"article" : {
"analyzer" : "french",
"properties" : {
"id" : {
"type" : "long"
},
"published_at" : {
"type" : "date",
"format" : "dateOptionalTime"
},
"summary" : {
"type" : "string"
},
"title" : {
"type" : "string"
},
"url" : {
"type" : "string"
}
}
}
}

My query too :

{"query":{"query_string":{"query":"perchoir"}},"highlight":{"fields":
{"title":{}}}}

If I add store:yes to the previous mapping, highlighting works
otherwise no.

Thanks all


(system) #2