Created
October 29, 2013 10:43
-
-
Save brwe/7212356 to your computer and use it in GitHub Desktop.
scoring oddities
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#init data | |
DELETE testtags/ | |
POST testtags/ | |
{ | |
"settings" : { | |
"index" : { | |
"number_of_shards" : 1, | |
"number_of_replicas" : 0 | |
} | |
} | |
} | |
#oddities of text scoring | |
POST testtags/test/1 | |
{ | |
"location": ["berlin","munich","hamburg"] | |
} | |
POST testtags/test/3 | |
{ | |
"location": "berlin" | |
} | |
POST testtags/test/_search | |
{ | |
"query": { | |
"match": { | |
"location": "berlin" | |
} | |
} | |
} | |
POST idfidx/test/2 | |
{ | |
"location": "berlin berlin" | |
} | |
POST idfidx/test/_search | |
{ | |
"query": { | |
"match": { | |
"location": "berlin" | |
} | |
} | |
} | |
POST idfidx/test/_search | |
{ | |
"query": { | |
"match": { | |
"location": "berlin kreuzberg" | |
} | |
} | |
} | |
POST idfidx/test/4 | |
{ | |
"location": "kreuzberg" | |
} | |
POST idfidx/test/_search | |
POST idfidx/test/_search | |
{ | |
"query": { | |
"match": { | |
"location": "berlin kreuzberg" | |
} | |
} | |
} | |
# multi match - even more complications! | |
DELETE idfidx/ | |
POST idfidx/ | |
{ | |
"settings" : { | |
"index" : { | |
"number_of_shards" : 1, | |
"number_of_replicas" : 0 | |
} | |
} | |
} | |
POST idfidx/test/1 | |
{ | |
"name":"ice for responsible people that like pandas", | |
"food": "ice cream", | |
"location": "berlin kreuzberg" | |
} | |
POST idfidx/test/2 | |
{ | |
"name":"ice for a low price", | |
"food": "ice cream", | |
"location": "berlin kreuzberg (check kreuzberg out now while it is still cool!)" | |
} | |
POST idfidx/test/_search | |
{ | |
"query": { | |
"multi_match": { | |
"query": "ice cream berlin kreuzberg", | |
"fields": ["food","location"] | |
} | |
} | |
} | |
#should be lower because of the field length, right? why both same score? | |
POST idfidx/test/1 | |
{ | |
"name":"out of nizza", | |
"food": "lobster oysters", | |
"location": "berlin kreuzberg" | |
} | |
POST idfidx/test/2 | |
{ | |
"name":"ice for a high price", | |
"food": "ice cream", | |
"location": "potsdam babelsberg" | |
} | |
POST idfidx/test/3 | |
{ | |
"name":"ice for a low price", | |
"food": "ice cream", | |
"location": "berlin kreuzberg" | |
} | |
POST idfidx/test/_search | |
POST idfidx/test/_search | |
{ | |
"query": { | |
"multi_match": { | |
"query": "ice cream berlin kreuzberg", | |
"fields": ["food","location"] | |
} | |
}, | |
"explain": false | |
} | |
# why ice cream in berlin kreuzberg last? | |
POST idfidx/test/4 | |
{ | |
"name":"karate", | |
"food": "sushi", | |
"location": "berlin kreuzberg" | |
} | |
DELETE idfidx/test/4 | |
POST idfidx/test/_search | |
{ | |
"query": { | |
"multi_match": { | |
"query": "ice cream berlin kreuzberg", | |
"fields": ["food","location"] | |
} | |
}, | |
"explain": false | |
} | |
#why 1 and 4 lower? -> again idf! remember from before! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment