# How to use pre\_tags and post\_tags in Elasticsearch?

**URL:** <https://discuss.elastic.co/t/how-to-use-pre-tags-and-post-tags-in-elasticsearch/88565>\
**Category:** Elasticsearch\
**Created:** [June 7, 2017, 11:29am UTC](https://discuss.elastic.co/t/how-to-use-pre-tags-and-post-tags-in-elasticsearch/88565 "2017-06-07T11:29:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yaswanth](https://avatars.discourse-cdn.com/v4/letter/y/94ad74/32.png) [@Yaswanth](https://discuss.elastic.co/u/Yaswanth)\
**Post date:** [June 7, 2017, 11:29am UTC](https://discuss.elastic.co/t/how-to-use-pre-tags-and-post-tags-in-elasticsearch/88565/1 "2017-06-07T11:29:21Z")

</div>

Hi,

I want to highlight a field in elasticsearch i used the [Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-highlighting.html) 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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:29am UTC](https://discuss.elastic.co/t/how-to-use-pre-tags-and-post-tags-in-elasticsearch/88565/2 "2017-07-05T11:29:22Z")

</div>

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