# Boost field does not work

**URL:** <https://discuss.elastic.co/t/boost-field-does-not-work/18146>\
**Category:** Elasticsearch\
**Created:** [June 17, 2014, 4:35am UTC](https://discuss.elastic.co/t/boost-field-does-not-work/18146 "2014-06-17T04:35:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Felix\_Xu](https://avatars.discourse-cdn.com/v4/letter/f/b3f665/32.png) [@Felix\_Xu](https://discuss.elastic.co/u/Felix_Xu)\
**Post date:** [June 17, 2014, 4:35am UTC](https://discuss.elastic.co/t/boost-field-does-not-work/18146/1 "2014-06-17T04:35:37Z")

</div>

Hi Guys,  
I have two types in a index, one is used for indexing topics and another  
one is used for indexing comments.  
Here is the sample mapping:

_Topic_:

curl -XPUT [http://localhost:9200/bbs/topic/\_mapping](http://localhost:9200/bbs/topic/_mapping) -d'  
{  
"topic": {  
"\_timestamp": {  
"enabled": true  
},  
"properties": {  
"title": {  
"type": "string",  
"store": true,  
"term\_vector": "with\_positions\_offsets",  
"indexAnalyzer": "ik",  
"searchAnalyzer": "ik",  
"include\_in\_all": true,  
_"boost": 8_  
},  
"content": {  
"type": "string",  
"store": true,  
"term\_vector": "with\_positions\_offsets",  
"indexAnalyzer": "ik",  
"searchAnalyzer": "ik",  
"include\_in\_all": true,  
_"boost": 4_  
}  
}  
}

_Comment_:

curl -XPUT [http://localhost:9200/bbs/comment/\_mapping](http://localhost:9200/bbs/comment/_mapping) -d'  
{  
"comment": {  
"\_timestamp": {  
"enabled": true  
},  
"properties": {  
"title": {  
"type": "string",  
"store": true,  
"term\_vector": "with\_positions\_offsets",  
"indexAnalyzer": "ik",  
"searchAnalyzer": "ik",  
"include\_in\_all": true,  
_"boost": 0_  
},  
"content": {  
"type": "string",  
"store": true,  
"term\_vector": "with\_positions\_offsets",  
"indexAnalyzer": "ik",  
"searchAnalyzer": "ik",  
"include\_in\_all": true,  
_"boost": 4_  
}  
}  
}

I want to search theses two types(title,content of Topic and only content  
of Comment) at the same time, however, I do not want to match the "title"  
field of comments, since the title is the same with its corresponding  
topic, matching the title field of a comment does not make any sense.  
I have tried to set the boost value of Comment's title field to zero but it  
seems does not work..  
I think a simple solution is to set the "title" of Comment with  
"not\_analyzed", but I also want to highlight the matching words in the  
title, so it's better to also index the title field but let it have little  
effects on scoring..  
Could someone please give me some hints? Thanks!

--  
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/4dac461c-03ab-4014-ab27-53b50b01e8b5%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4dac461c-03ab-4014-ab27-53b50b01e8b5%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [June 17, 2014, 5:17pm UTC](https://discuss.elastic.co/t/boost-field-does-not-work/18146/2 "2014-06-17T17:17:54Z")

</div>

How do you know that the search is not working? Can you post an example  
query and perhaps an example explanation?

If you are searching against the all field, you can set include\_in\_all to  
false for that field. You are better off not searching a field instead of  
trying to set a boost.

Cheers,

Ivan

On Mon, Jun 16, 2014 at 9:35 PM, Felix Xu [ygnhzeus@gmail.com](mailto:ygnhzeus@gmail.com) wrote:

> Hi Guys,  
> I have two types in a index, one is used for indexing topics and another  
> one is used for indexing comments.  
> Here is the sample mapping:
> 
> _Topic_:
> 
> curl -XPUT [http://localhost:9200/bbs/topic/\_mapping](http://localhost:9200/bbs/topic/_mapping) -d'  
> {  
> "topic": {  
> "\_timestamp": {  
> "enabled": true  
> },  
> "properties": {  
> "title": {  
> "type": "string",  
> "store": true,  
> "term\_vector": "with\_positions\_offsets",  
> "indexAnalyzer": "ik",  
> "searchAnalyzer": "ik",  
> "include\_in\_all": true,  
> _"boost": 8_  
> },  
> "content": {  
> "type": "string",  
> "store": true,  
> "term\_vector": "with\_positions\_offsets",  
> "indexAnalyzer": "ik",  
> "searchAnalyzer": "ik",  
> "include\_in\_all": true,  
> _"boost": 4_  
> }  
> }  
> }
> 
> _Comment_:
> 
> curl -XPUT [http://localhost:9200/bbs/comment/\_mapping](http://localhost:9200/bbs/comment/_mapping) -d'  
> {  
> "comment": {  
> "\_timestamp": {  
> "enabled": true  
> },  
> "properties": {  
> "title": {  
> "type": "string",  
> "store": true,  
> "term\_vector": "with\_positions\_offsets",  
> "indexAnalyzer": "ik",  
> "searchAnalyzer": "ik",  
> "include\_in\_all": true,  
> _"boost": 0_  
> },  
> "content": {  
> "type": "string",  
> "store": true,  
> "term\_vector": "with\_positions\_offsets",  
> "indexAnalyzer": "ik",  
> "searchAnalyzer": "ik",  
> "include\_in\_all": true,  
> _"boost": 4_  
> }  
> }  
> }
> 
> I want to search theses two types(title,content of Topic and only content  
> of Comment) at the same time, however, I do not want to match the "title"  
> field of comments, since the title is the same with its corresponding  
> topic, matching the title field of a comment does not make any sense.  
> I have tried to set the boost value of Comment's title field to zero but  
> it seems does not work..  
> I think a simple solution is to set the "title" of Comment with  
> "not\_analyzed", but I also want to highlight the matching words in the  
> title, so it's better to also index the title field but let it have little  
> effects on scoring..  
> Could someone please give me some hints? Thanks!
> 
> --  
> 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/4dac461c-03ab-4014-ab27-53b50b01e8b5%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4dac461c-03ab-4014-ab27-53b50b01e8b5%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/4dac461c-03ab-4014-ab27-53b50b01e8b5%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/4dac461c-03ab-4014-ab27-53b50b01e8b5%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](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+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC0qnQn5oQKJoWJ1g5F8FR2KRjOOQJ9tx8GLcLyuWp-Kw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC0qnQn5oQKJoWJ1g5F8FR2KRjOOQJ9tx8GLcLyuWp-Kw%40mail.gmail.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:21am UTC](https://discuss.elastic.co/t/boost-field-does-not-work/18146/3 "2017-07-06T01:21:45Z")

</div>


