Can you post an example document?  Can you post your mapping?  Mapping is
important because depending on how your mapping is set up you'll get a
totally different highlighter implementation.

Nik

On Wed, Nov 26, 2014 at 11:26 AM, Deepak Mehta <hopeligh...@gmail.com>
wrote:

> I am using Elastic Search 1.3.5.
> I have fields like filename, foldername and content. In query I am trying
> to highlight matched content.
>
> In Query if keyword only matches in content then keyword is highlighted
> and its becoming bold. However if keyword matches in (filename or
> foldername) and content then content is not highlighted.
> What I am missing here?
>
> Query sample,
>
> {
>     "query": {
>         "filtered": {
>             "query": {
>                 "bool": {
>                     "should": [
>                         {
>                             "match": {
>                                 "fileName": {
>                                     "query": "document",
>                                     "boost": 4
>                                 }
>                             }
>                         },
>                         {
>                             "match": {
>                                 "folderName": {
>                                     "query": "document",
>                                     "boost": 3
>                                 }
>                             }
>                         },
>                         {
>                             "match": {
>                                 "fileName.trigram": {
>                                     "query": "document",
>                                     "boost": 2,
>                                     "minimum_should_match": "50%"
>                                 }
>                             }
>                         },
>                         {
>                             "match": {
>                                 "content": {
>                                     "query": "document",
>                                     "boost": 5
>                                 }
>                             }
>                         },
>                         {
>                             "match": {
>                                 "folderName.trigram": {
>                                     "query": "document",
>                                     "boost": 1,
>                                     "minimum_should_match": "50%"
>                                 }
>                             }
>                         }
>                     ]
>                 }
>             },
>             "filter": {
>                 "and": [
>                     {
>                         "term": {
>                             "businessId": 1
>                         }
>                     },
>                     {
>                         "term": {
>                             "deleted": false
>                         }
>                     },
>                     {
>                         "bool": {
>                             "should": [
>                                 {
>                                     "term": {
>                                         "folderPath": "/shared/documents"
>                                     }
>                                 },
>                                 {
>                                     "prefix": {
>                                         "folderPath": "/shared/documents/"
>                                     }
>                                 }
>                             ]
>                         }
>                     }
>                 ]
>             }
>         }
>     },
>     "highlight": {
>         "fields": {
>             "content": {
>                 "fragment_size": 150,
>                 "number_of_fragments": 0,
>                 "no_match_size": 150
>             }
>         },
>         "pre_tags": [
>             "<Bold>"
>         ],
>         "post_tags": [
>             "</Bold>"
>         ]
>     }
> }
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/5fffefc1-c2f3-4b2d-aa64-b804da6dc3ff%40googlegroups.com
> <https://groups.google.com/d/msgid/elasticsearch/5fffefc1-c2f3-4b2d-aa64-b804da6dc3ff%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CAPmjWd10Depf6q5cdsAfpkd-cbdYtimGhCfkeX4SKU2JFXYZXg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to