Boost field does not work


(Felix Xu) #1

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 -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 -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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/a635b0ca-d669-49c1-9263-1e5a682e63f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #2