# Skip html tags on indexing

**URL:** <https://discuss.elastic.co/t/skip-html-tags-on-indexing/16635>\
**Category:** Elasticsearch\
**Created:** [March 27, 2014, 9:24am UTC](https://discuss.elastic.co/t/skip-html-tags-on-indexing/16635 "2014-03-27T09:24:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexandr\_Yakubenko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexandr_yakubenko/32/1691_2.png) [@Alexandr\_Yakubenko](https://discuss.elastic.co/u/Alexandr_Yakubenko)\
**Post date:** [March 27, 2014, 9:24am UTC](https://discuss.elastic.co/t/skip-html-tags-on-indexing/16635/1 "2014-03-27T09:24:59Z")

</div>

I have a next custom analyzer for description-field of document:

/\_settings :  
"analysis" : {  
"analyzer" : {  
"snowball\_without\_tags" : {  
"char\_filter" : ["html\_strip"],  
"tokenizer" : "standard",  
"type" : "custom",  
"filter" : ["standard", "lowercase", "stop", "snowball"]  
}  
}  
},

/\_mapping :

```
      "description" : {
        "type" : "string",
        "analyzer" : "snowball_without_tags"
      },

```

I have a next document:

{  
"id":"426923832-32907\_jobs\_to\_careers",  
"position":"Executives - Be Your Own Boss and Own A Franchise (32907)",  
"description":"

\<span style=\"font-size: x-large;\"\>Be Your Own Boss!

 

\<span style=\"font-size: x-large;\"\>Over 30 starting under $10,000. Browse the top franchises for 2013 for food, tech, home-based, and many more.

 

 

\<span style=\"font-size: x-large;\"\>We offer one of the largest directories of Franchise and Business Opportunities on the internet.

 

 

\<span style=\"font-size: x-large;\"\>We work with the big guys you've heard of and the new guys that everyone will be talking about soon, making Gator your one-stop-shop for business ownership information and research. We also have hundreds of articles about franchising to help educate you on buying a business.

 "  
}

And I'm trying to do a search for this document by 'span'-query:

curl -X GET '[http://localhost:9200/jobs/\_search?size=0](http://localhost:9200/jobs/_search?size=0)' -d '{"query":{"query\_string":{"query":"span"}},"filter":{"term":{"id":"426923832-32907\_jobs\_to\_careers"}}}'

And document is found by tag in a description.

{"took":9,"timed\_out":false,"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max\_score":0.0,"hits":[]}}

Could you guys help me to configure my analyzer to skip tags from analyzed text please?

--  
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+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/7621a17e-31b6-4b2c-800d-019500188354%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/7621a17e-31b6-4b2c-800d-019500188354%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Binh\_Ly\_2](https://avatars.discourse-cdn.com/v4/letter/b/d07c76/32.png) [@Binh\_Ly\_2](https://discuss.elastic.co/u/Binh_Ly_2)\
**Post date:** [March 27, 2014, 12:59pm UTC](https://discuss.elastic.co/t/skip-html-tags-on-indexing/16635/2 "2014-03-27T12:59:03Z")

</div>

The html\_strip is applied to your description field so it will work only if  
you search in that field:

{  
"query": {  
"query\_string": {  
"query": "description:span"  
}  
}  
}

Your example search looks in the \_all field by default which is using the  
standard analyzer. You can apply your analyzer to the \_all field if you  
like after which you will get your desired results:

"mappings": {  
"doc": {  
"\_all": {  
"type": "string",  
"analyzer": "snowball\_without\_tags"  
},  
"properties": {  
}  
}  
}

--  
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+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/d8b47ed4-2ecd-40ea-ab83-becb21d45cc4%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d8b47ed4-2ecd-40ea-ab83-becb21d45cc4%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Alexandr\_Yakubenko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexandr_yakubenko/32/1691_2.png) [@Alexandr\_Yakubenko](https://discuss.elastic.co/u/Alexandr_Yakubenko)\
**Post date:** [March 27, 2014, 1:12pm UTC](https://discuss.elastic.co/t/skip-html-tags-on-indexing/16635/3 "2014-03-27T13:12:56Z")

</div>

Got it.

Your answer is very helpful. Thank you very much.

четверг, 27 марта 2014 г., 15:59:03 UTC+3 пользователь Binh Ly написал:

> The html\_strip is applied to your description field so it will work only  
> if you search in that field:
> 
> {  
> "query": {  
> "query\_string": {  
> "query": "description:span"  
> }  
> }  
> }
> 
> Your example search looks in the \_all field by default which is using the  
> standard analyzer. You can apply your analyzer to the \_all field if you  
> like after which you will get your desired results:
> 
> "mappings": {  
> "doc": {  
> "\_all": {  
> "type": "string",  
> "analyzer": "snowball\_without\_tags"  
> },  
> "properties": {  
> }  
> }  
> }

--  
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+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/e64624e2-049b-4753-9a69-6d33f650a62c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e64624e2-049b-4753-9a69-6d33f650a62c%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 1:40am UTC](https://discuss.elastic.co/t/skip-html-tags-on-indexing/16635/4 "2017-07-06T01:40:14Z")

</div>


