Elastic Search Scoring - Query Terms Boost


(Pratik Poddar) #1

Hey,

Sorry for the noob question. Realy appreciate if someone can help me
through this. I am using Elastic Search python. I am search a string like
"Arvind Kejriwal India Today Economic Times" and it gives me reasonable
results. I was hoping I could increase weight of the first words more in
the search query. How can I do that?

res = es.search(index="article-index", fields="url", body={"query":
{"query_string": {"query": keywordstr, "fields": ["text", "title", "tags",
"domain"]}}})

I am using the above command to search right now.

--
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/8cecfda7-ab8b-4d0a-9a30-babd869b39c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Honza Král) #2

Hi Pratik,

in Lucene query syntax, which is what query_string uses, supports
boosting of terms with ^N notation (0), so

"Arvind^6 Kejriwal^6 India Today economic times"

will mark the two first terms as more important.

0 - http://lucene.apache.org/core/2_9_4/queryparsersyntax.html#Boosting%20a%20Term

Hope this helps,
Honza

On Tue, Mar 18, 2014 at 11:25 AM, Pratik Poddar pratik.phodu@gmail.com wrote:

Hey,

Sorry for the noob question. Realy appreciate if someone can help me through
this. I am using Elastic Search python. I am search a string like "Arvind
Kejriwal India Today Economic Times" and it gives me reasonable results. I
was hoping I could increase weight of the first words more in the search
query. How can I do that?

res = es.search(index="article-index", fields="url", body={"query":
{"query_string": {"query": keywordstr, "fields": ["text", "title", "tags",
"domain"]}}})

I am using the above command to search right now.

http://stackoverflow.com/questions/22476315/elastic-search-boost-query-corresponding-to-first-search-term

--
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/8cecfda7-ab8b-4d0a-9a30-babd869b39c4%40googlegroups.com.
For more options, visit 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CABfdDir0XEpCtL3Yt1k7x2U9JG-PHS7H4k6JiuGSdUkR_2D8tg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(Pratik Poddar) #3

Thanks. That worked like a charm.

On Tuesday, March 18, 2014 7:50:01 PM UTC+5:30, Honza Král wrote:

Hi Pratik,

in Lucene query syntax, which is what query_string uses, supports
boosting of terms with ^N notation (0), so

"Arvind^6 Kejriwal^6 India Today economic times"

will mark the two first terms as more important.

0 -
http://lucene.apache.org/core/2_9_4/queryparsersyntax.html#Boosting%20a%20Term

Hope this helps,
Honza

On Tue, Mar 18, 2014 at 11:25 AM, Pratik Poddar <pratik...@gmail.com<javascript:>>
wrote:

Hey,

Sorry for the noob question. Realy appreciate if someone can help me
through
this. I am using Elastic Search python. I am search a string like
"Arvind
Kejriwal India Today Economic Times" and it gives me reasonable results.
I
was hoping I could increase weight of the first words more in the search
query. How can I do that?

res = es.search(index="article-index", fields="url", body={"query":
{"query_string": {"query": keywordstr, "fields": ["text", "title",
"tags",
"domain"]}}})

I am using the above command to search right now.

http://stackoverflow.com/questions/22476315/elastic-search-boost-query-corresponding-to-first-search-term

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit

https://groups.google.com/d/msgid/elasticsearch/8cecfda7-ab8b-4d0a-9a30-babd869b39c4%40googlegroups.com.

For more options, visit 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/a87303f3-d716-4838-9fca-4709f8d3c18b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #4