Search score


(Honjoya) #1

Hi, i am beginner in elasticsearch, and have a doubt:
i am doing one search but the result not is much relevent.

I search "notebook" , but the document with " Bag black for notebook" is
not last item in result.... but this should be the last record because not
it begins with the word "notebook"

somebody have a solutions?

Thanks

example:

http://localhost:9200/teste/ofertas/_search/ -d

"{
"query": {
"term": {
"name": "notebook"
}
}
}"

my result:

{
took: 4
timed_out: false
_shards: { total: 5successful: 5failed: 0}
hits: {
total: 6
max_score: 4.232868
hits: [
{
_index: teste
_type: ofertas
_id: 3
_score: 4.232868
_source: {
name: Notebook ACER mod 1862
}
}
{
_index: teste
_type: ofertas
_id: 2
_score: 3.5136628
_source: {
nome: HP pavillion notebook
}
}
{
_index: teste
_type: ofertas
_id: 1
_score: 3.2192051
_source: {
name: Notebook dell inspirion
}
}
{
_index: teste
_type: ofertas
_id: 6
_score: 3.2192051
_source: {
name: Bag black for notebook
}
}
{
_index: teste
_type: ofertas
_id: 4
_score: 2.5
_source: {
name: Acer Notebook serie gammer
}
}
{
_index: teste
_type: ofertas
_id: 5
_score: 2.4748738
_source: {
name: Notebook dell inspiriom 1525 the better notebook
}
}
]
}
}


(Ivan Brusic) #2

ElasticSearch is based on Lucene, so the concepts of scoring are the
same. Review them for a better understanding.

Turn on "explain" to understand why the documents are scored in the
way they are. The document for "Bag black for notebook" (6) scores
higher than the one for "Acer Notebook serie gammer". (4) Why? My
guess is term frequencies. Documents with fewer overall terms score
higher when using TDIDF scoring. "For" is a stopword, so document 6
only has 3 terms. Document 1 has the same score and number of terms.
Word position has no relevance with standard queries.

Here are some definitions for terms in Lucene:
http://www.lucidimagination.com/content/scaling-lucene-and-solr#d0e58

Cheers,

Ivan

On Tue, Jul 31, 2012 at 2:51 PM, elasticSearchUserBeginner
ti.honjoya@gmail.com wrote:

Hi, i am beginner in elasticsearch, and have a doubt:
i am doing one search but the result not is much relevent.

I search "notebook" , but the document with " Bag black for notebook" is
not last item in result.... but this should be the last record because not
it begins with the word "notebook"

somebody have a solutions?

Thanks

example:

http://localhost:9200/teste/ofertas/_search/ -d

"{
"query": {
"term": {
"name": "notebook"
}
}
}"

my result:

{
took: 4
timed_out: false
_shards: { total: 5successful: 5failed: 0}
hits: {
total: 6
max_score: 4.232868
hits: [
{
_index: teste
_type: ofertas
_id: 3
_score: 4.232868
_source: {
name: Notebook ACER mod 1862
}
}
{
_index: teste
_type: ofertas
_id: 2
_score: 3.5136628
_source: {
nome: HP pavillion notebook
}
}
{
_index: teste
_type: ofertas
_id: 1
_score: 3.2192051
_source: {
name: Notebook dell inspirion
}
}
{
_index: teste
_type: ofertas
_id: 6
_score: 3.2192051
_source: {
name: Bag black for notebook
}
}
{
_index: teste
_type: ofertas
_id: 4
_score: 2.5
_source: {
name: Acer Notebook serie gammer
}
}
{
_index: teste
_type: ofertas
_id: 5
_score: 2.4748738
_source: {
name: Notebook dell inspiriom 1525 the better notebook
}
}
]
}
}


(Vinicius Carvalho) #3

Does not work like that.

First, send some information on your mapping and indexing configuration
(what analyzer you used for the fields)

Starting with a word does not mean that it will get a higher score (maybe
if you use some sort of query with positional information, but I'm just
guessing here). Have a look
on http://lucene.apache.org/core/3_6_0/scoring.html to have an idea how
scoring works.

Regards

On Tuesday, July 31, 2012 5:51:37 PM UTC-4, elasticSearchUserBeginner wrote:

Hi, i am beginner in elasticsearch, and have a doubt:
i am doing one search but the result not is much relevent.

I search "notebook" , but the document with " Bag black for notebook" is
not last item in result.... but this should be the last record because not
it begins with the word "notebook"

somebody have a solutions?

Thanks

example:

http://localhost:9200/teste/ofertas/_search/ -d

"{
"query": {
"term": {
"name": "notebook"
}
}
}"

my result:

{
took: 4
timed_out: false
_shards: { total: 5successful: 5failed: 0}
hits: {
total: 6
max_score: 4.232868
hits: [
{
_index: teste
_type: ofertas
_id: 3
_score: 4.232868
_source: {
name: Notebook ACER mod 1862
}
}
{
_index: teste
_type: ofertas
_id: 2
_score: 3.5136628
_source: {
nome: HP pavillion notebook
}
}
{
_index: teste
_type: ofertas
_id: 1
_score: 3.2192051
_source: {
name: Notebook dell inspirion
}
}
{
_index: teste
_type: ofertas
_id: 6
_score: 3.2192051
_source: {
name: Bag black for notebook
}
}
{
_index: teste
_type: ofertas
_id: 4
_score: 2.5
_source: {
name: Acer Notebook serie gammer
}
}
{
_index: teste
_type: ofertas
_id: 5
_score: 2.4748738
_source: {
name: Notebook dell inspiriom 1525 the better notebook
}
}
]
}
}


(system) #4