shaybix
(Shaybix)
June 25, 2015, 12:34am
1
I have indexed Arabic books and when I query the content I get match, but no highlighting.
This is the query I ran (I modified the documentation example):
{
"query" : {
"match": {
"page_body": "الله"
}
},
"highlight" : {
"fields" : {
"_all" : { "pre_tags" : ["<em>"], "post_tags" : ["</em>"] }
}
}
}
Am I doing something wrong?
shinyke
(昕玫)
June 25, 2015, 1:49am
2
Is it a problem about Arabic language compatible? Can you give more imformation like your indexed doc and the return of this query.
shaybix
(Shaybix)
June 28, 2015, 6:38pm
3
I managed to resolve the issue. I didn't know in my mappings I had to set the field I wanted to later on get highlights, the store as true.
"mappings" : {
"pages" : {
"_source" : { "enabled" : true },
"properties" : {
"page_body": {
"type": "string",
"index": "analyzed",
"store": true
},
"book": {
"properties": {
"category" : { "type" : "string", "index" : "not_analyzed" }
}
}
}
}
}
}
and then the query like this:
{
"query" : {
"match": {
"page_body": "الله"
}
},
"highlight" : {
"fields" : {
"page_body" : {
"pre_tags" : ["</em>"],
"post_tags": ["<em>"]
}
}
}
}
Thanks for the quick reply.