# Boost parts of text (content of HTML tags)

**URL:** <https://discuss.elastic.co/t/boost-parts-of-text-content-of-html-tags/13921>\
**Category:** Elasticsearch\
**Created:** [October 11, 2013, 9:11am UTC](https://discuss.elastic.co/t/boost-parts-of-text-content-of-html-tags/13921 "2013-10-11T09:11:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anrikun](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@anrikun](https://discuss.elastic.co/u/anrikun)\
**Post date:** [October 11, 2013, 9:11am UTC](https://discuss.elastic.co/t/boost-parts-of-text-content-of-html-tags/13921/1 "2013-10-11T09:11:08Z")

</div>

Hi,  
I know that it is possible to boost documents and fields at indexing time.  
But is it possible to boost parts of text inside a field?  
I want to index HTML content with Hn and STRONG tags that I would like to  
get boosted accordingly.  
I could index a structure like:  
[{  
"value": "Content of a H1 tag",  
"boost": 5.0  
}, {  
"value": "Content of a STRONG tag",  
"boost": 2.0  
}, {  
"value": "Some normal text",  
"boost": 1.0  
}]

But is there a way to let ES know how to handle this boost parameter?

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [October 14, 2013, 7:31am UTC](https://discuss.elastic.co/t/boost-parts-of-text-content-of-html-tags/13921/2 "2013-10-14T07:31:29Z")

</div>

Hey,

I have no good idea of doing this inside of elasticsearch on the top of my  
head right now. Maybe you could split the tags on indexing in your  
application and index into specific fields and boost these fields more on  
query time?

Also, when you want to index HTML content, you should actually strip the  
HTML before indexing your data, otherwise a **tag gets indexed as  
the word 'strong' in your search index.  
See the html\_strip char filter**

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

 

 

**Hope this helps..**

 

**--Alex**

 

**On Fri, Oct 11, 2013 at 11:11 AM, anrikun [henri.medot@gmail.com](mailto:henri.medot@gmail.com) wrote:**

 

**> Hi,  
> I know that it is possible to boost documents and fields at indexing time.  
> But is it possible to boost parts of text inside a field?  
> I want to index HTML content with Hn and STRONG tags that I would like to  
> get boosted accordingly.  
> I could index a structure like:  
> [{  
> "value": "Content of a H1 tag",  
> "boost": 5.0  
> }, {  
> "value": "Content of a STRONG tag",  
> "boost": 2.0  
> }, {  
> "value": "Some normal text",  
> "boost": 1.0  
> }]
> 
> But is there a way to let ES know how to handle this boost parameter?
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).**

 

**--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).**

---

<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, 2:12am UTC](https://discuss.elastic.co/t/boost-parts-of-text-content-of-html-tags/13921/3 "2017-07-06T02:12:39Z")

</div>


