How to use pre_tags and post_tags in Elasticsearch?

Hi,

I want to highlight a field in elasticsearch i used the Documentation and used below query to highlight "name"

POST /bank/_search
{
    "query" : {
        "match": { "country": "uk" }
    },
    "highlight" : {
        "fields" : {
            "*" : {}
        }
    }
}

Response

       "country": [
          "<em>uk</em>"
       ]

I had also seen the code snippet

GET /_search
{
    "query" : {
        "match": { "user": "kimchy" }
    },
    "highlight" : {
        "pre_tags" : ["<tag1>"],
        "post_tags" : ["</tag1>"],
        "fields" : {
            "_all" : {}
        }
    }
}

What i had keep in pre_tags and post_tags? Give you give a example on the usuage of the above snippet?

THANKS

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.